[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [HELP] (bug?) Saving a buffer without any conversion?
From: |
Kim F. Storm |
Subject: |
Re: [HELP] (bug?) Saving a buffer without any conversion? |
Date: |
14 Jan 2003 02:00:05 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
Mario Lang <address@hidden> writes:
> Hi there.
>
> I'm trying to sort out a bug in erc-dcc.el since some time now and since
> I'm really lost now, I thought I'd ask here, and maybe get some enlightenment:
>
> 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.
Actually the value returned by (buffer-size) in the buffer containing
the received binary data equals the size of the original data (so if
seen from the lisp level, the buffer contains the right number of
bytes). But when written to disk, the internal representation of the
buffer is stored instead of the "data".
The buffer's coding system for save is no-conversion. How did
that internal data end up in the file?
What coding systems should be set on the network process and on the
buffer to make it possible to have the received binary data in the
buffer make its way unmangled into the file on the disk?
--
Kim F. Storm <address@hidden> http://www.cua.dk