From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Mario Lang Newsgroups: gmane.emacs.devel Subject: Re: [HELP] (bug?) Saving a buffer without any conversion? Date: Tue, 14 Jan 2003 07:46:11 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87n0m4rzyk.fsf@lexx.delysid.org> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1042526784 22511 80.91.224.249 (14 Jan 2003 06:46:24 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 14 Jan 2003 06:46:24 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18YKq5-0005qi-00 for ; Tue, 14 Jan 2003 07:46:21 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18YKxu-0001mr-00 for ; Tue, 14 Jan 2003 07:54:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18YKqc-0002BV-04 for emacs-devel@quimby.gnus.org; Tue, 14 Jan 2003 01:46:54 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18YKqR-000223-00 for emacs-devel@gnu.org; Tue, 14 Jan 2003 01:46:43 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18YKqH-0001me-00 for emacs-devel@gnu.org; Tue, 14 Jan 2003 01:46:37 -0500 Original-Received: from [80.109.223.66] (helo=lexx.delysid.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18YKqD-0001HY-00 for emacs-devel@gnu.org; Tue, 14 Jan 2003 01:46:29 -0500 Original-Received: from mlang by lexx.delysid.org with local (Exim 3.36 #1 (Debian)) id 18YKpv-0008C1-00; Tue, 14 Jan 2003 07:46:11 +0100 Original-To: Eli Zaretskii In-Reply-To: (Eli Zaretskii's message of "Tue, 14 Jan 2003 08:06:02 +0200 (IST)") User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu) 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:10717 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:10717 Eli Zaretskii writes: > On 14 Jan 2003, Kim F. Storm wrote: > >> > We're receiving binary content via a network process. After the >> > transfer is complete, this buffer should be saved to a file. >> > >> > The effect I'm having is that we receive 1372422 bytes via the process >> > filter function STRING argument, and after insertion into a buffer, >> > we have a buffer with buffer-size 1372422, but after calling (save-buffer) >> > we get this: >> > >> > -rw-r--r-- 1 root root 1865264 Jan 13 18:35 blah28.mp3 >> > >> > I'm using: >> > >> > (set-process-coding-system proc 'binary 'binary) >> > (set-buffer-file-coding-system 'no-conversion t) >> > >> >> I have looked at Mario's data before sending it to emacs and after >> emacs has written it to a file. >> >> It seems that every byte in the range 0xa0 .. 0xff that were in the >> original file is prefixed with an 0x81 byte in the file containing the >> received data. To me, that looks like the internal multi-byte >> representation for the binary data. > > Yes. That's what no-conversion does: it prevents encoding of the > internal buffer's contents. > > I suggest to use raw-text for both coding systems above, and see if that > helps. I've tried that now, and no. 'raw-text has the same effect as 'no-conversion or 'binary.... > An alternative approach is to (set-buffer-multibyte nil) before reading > the data into it and before saving it. This works! Thanks! But I'm still a bit confused as to why setting coding-system does not help. >> The buffer's coding system for save is no-conversion. How did >> that internal data end up in the file? > > Probably because the buffer was a multibyte buffer, in which case > no-conversion writes out the internal representation. That's why I > suggested using raw-text to save the buffer. Hmm, well raw-text sounds right, but it doesnt work. Any idea why? -- CYa, Mario