From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: Different (buffer-file-)coding-systems for different regions of one buffer? (for Rmail MIME) Date: Wed, 21 May 2003 15:53:09 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200305211953.h4LJr9Iq000699@rum.cs.yale.edu> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1053548351 10935 80.91.224.249 (21 May 2003 20:19:11 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 21 May 2003 20:19:11 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed May 21 22:19:05 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19Ia2a-0002mc-00 for ; Wed, 21 May 2003 22:18:24 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19IaDW-00038O-00 for ; Wed, 21 May 2003 22:29:42 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19IZoc-0000Xq-Tj for emacs-devel@quimby.gnus.org; Wed, 21 May 2003 16:03:58 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19IZj2-0007B8-Gu for emacs-devel@gnu.org; Wed, 21 May 2003 15:58:12 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19IZhO-0006ZB-8W for emacs-devel@gnu.org; Wed, 21 May 2003 15:57:01 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19IZeA-0006Ac-Lh for emacs-devel@gnu.org; Wed, 21 May 2003 15:53:10 -0400 Original-Received: from rum.cs.yale.edu (localhost [127.0.0.1]) by rum.cs.yale.edu (8.12.8/8.12.8) with ESMTP id h4LJrAx6000701; Wed, 21 May 2003 15:53:10 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.12.8/8.12.8/Submit) id h4LJr9Iq000699; Wed, 21 May 2003 15:53:09 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: stktrc X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:14060 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:14060 > Would it be possible to have different coding-systems (the decoding of > octets from a file into characters in a buffer) for different ranges > of octets in a file? Of course, it's possible: coding systems are operations, not data. Emacs offers straightforward ways to apply those operations to whole files when reading and saving them, as well as straightforward ways to apply those operations to parts of a buffer. > For example: in a file of 2000 octets, octet 1-1000 would be decoded > using ISO-8859-1, octet 1001-1500 with UTF-8, 1501-2000 with > (currently non-existent?) Quoted-Printable and so on. This would in > my opinion allow a pretty way of handling MIME messages. quoted-printable is not a coding-system. As for the rest, I don't see what's preventing you from doing it. After all Gnus does is. I.e. load the raw undecoded file, parse its content to figure out where parts begin and end and what coding-system to use for them (and maybe also un-base64 or un-qp them) and then apply decode-coding-region. Upon saving, just do the opposite. > Though I can't come up with any other uses except for the proposed > Rmail usage for different coding-systems for different regions, I > don't see how it is nonsense. It is like opening a file constructed > by concatenating several files with different character encodings (and > knowledge of what part of the file uses what encoding qould be > extracted from the MIME data). Do you see what I'm trying to > accomplish? I still don't understand what you want that's not already present. > Unless I have overlooked something, I *do* think it would be possible > to handle MIME messages nicely without replacing the encoded data, if > the facilities for decoding different parts of a file (which is done > with a coding-system, right?) with different character encodings > exist. I don't understand what you mean by "replacing". Stefan