[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: struct.el -- a package to encode/decode binary data
From: |
Eli Zaretskii |
Subject: |
Re: struct.el -- a package to encode/decode binary data |
Date: |
Tue, 19 Mar 2002 09:02:19 +0200 (IST) |
On 19 Mar 2002, Kim F. Storm wrote:
> While writing a package that sends and receives datagrams using the
> new make-network-process functionality, I quickly found that I needed
> to be able to encode and decode binary data structures, so I came up
> with the following package (struct.el).
>
> I'd like to hear if something like this already exists, or if others
> find it should be added to emacs (with more complete documentation of
> course). [Also, the struct-pack function doesn't work with nested
> data, but I'll fix that if there is an interest in this package].
I think it would be a very useful addition to Emacs, but I have one
comment about the implementation: I don't like (and that's an
understatement!) the idea of using unibyte strings. I especially get
shivers when I see string-make-unibyte and its ilk.
Unibyte strings and buffers are The Mother Of All Evil in Emacs--they are
the primary reason for those pesky \201 characters popping up in user
buffers. Thanks to titanic effort of Handa-san and others, Emacs mostly
does TRT with unibyte text, but I think we shouldn't test that too much
for our own good, especially in a package bundled with Emacs.
If I understand correctly what you want to do, there should be no reason
for unibyte text in your implementation. Emacs should be able to deal
with binary data as multibyte, just be sure to decode it as raw-text-unix.