unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Binary network communication appears broken
@ 2008-03-27 16:51 Harald Hanche-Olsen
  2008-03-27 18:52 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Harald Hanche-Olsen @ 2008-03-27 16:51 UTC (permalink / raw)
  To: emacs-pretest-bug

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?




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-27 20:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-27 16:51 Binary network communication appears broken Harald Hanche-Olsen
2008-03-27 18:52 ` Stefan Monnier
2008-03-27 20:09   ` Harald Hanche-Olsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).