emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Binary network communication appears broken


From: Harald Hanche-Olsen
Subject: Binary network communication appears broken
Date: Thu, 27 Mar 2008 17:51:50 +0100 (CET)

I discovered this because it breaks mew:

(This is with CVS emacs as of yesterday.
I spent many hours debugging my way to this simple test case.)

Define this function:

(defun test-net (coding)
  (interactive "SUse coding: ")
  (make-network-process
   :name "testproc"
   :host 'local :service 9898 :family 'ipv4
   :buffer "*testproc*"
   :coding coding
   :filter (lambda (proc string)
             (setq *test* string ))
   :sentinel (lambda (proc string)
               (delete-process proc))))

Set up a network service on port 9898 on localhost that just echos a
short string, then disconnect. The string should contain some
non-ASCII character. I used the string "målbar" (encoded as latin-1)
with a newline appended, total 7 bytes. (I used a one line shell
script under tcpserver. I suppose you could use inetd as well.)

Now run: M-x test-net RET binary RET

(Also tested with raw-text and no-conversion, same result.)

The string *test* now contains a string that appears to be 5
characters long: (insert *test*) certainly inserts 5 characters,
though (length *test*) returns 7. The string appears to be "m_ar\n",
where there is really a Chinese character in the position I indicated
with an underscore. (I am bending over backwards to avoid making this
a unicode encoded email. The character in question is #x5b22, if you
must know.) However, if I examine the characters of the text using
aref, it turns out to contain what I expected, except ?å is replaced
by #x5b22 again.

- Harald

PS. Please Cc me on replies, as I am not on the list. It appears
to be impossible to sign up for this list?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]