unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Fcall_process: wrong conversion
@ 2006-05-15  6:09 Herbert Euler
  2006-05-15 14:25 ` Stefan Monnier
  0 siblings, 1 reply; 18+ messages in thread
From: Herbert Euler @ 2006-05-15  6:09 UTC (permalink / raw)
  Cc: herberteuler

Hello,

Fcall_process in callproc.c, which is correspond to `call-process',
cannot handle UTF-16 (both LE or BE) correctly.  Take a look at line
417 to 424, callproc.c:

      for (i = 4; i < nargs; i++)
	{
	  argument_coding.src_multibyte = STRING_MULTIBYTE (args[i]);
	  if (CODING_REQUIRE_ENCODING (&argument_coding))
	    /* We must encode this argument.  */
	    args[i] = encode_coding_string (&argument_coding, args[i], 1);
	  new_argv[i - 3] = SDATA (args[i]);
	}

If encoding is UTF-16, encode_coding_string will convert all ascii
characters in an argument to wide ones, and add prefix to that
argument.  For example, if argv[4] is "-hex", it may be converted to
"\376\377\0-\0h\0e\0x", which is normally not a correct argument to
most programs and so causes these programs complaining about it.  Even
wide characters are converted to wrong arguments by adding "\376\377"
or "\377\376".

I found this problem when applying `hexl-mode' to UTF-16 texts.  Could
somebody help solve it?

And I don't know whether similar problems resides somewhere else.

Thanks very much.

Regards,
Guanpeng Xu

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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

end of thread, other threads:[~2006-05-19 10:41 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-15  6:09 Fcall_process: wrong conversion Herbert Euler
2006-05-15 14:25 ` Stefan Monnier
2006-05-15 15:17   ` Herbert Euler
2006-05-15 16:06     ` Stefan Monnier
2006-05-16  2:59       ` Herbert Euler
2006-05-16  4:10         ` Kenichi Handa
2006-05-16  4:34           ` Herbert Euler
2006-05-16  4:39             ` Kenichi Handa
2006-05-16  5:40               ` Herbert Euler
2006-05-18  2:24                 ` Kenichi Handa
2006-05-18  6:07                   ` Herbert Euler
2006-05-18  6:14                     ` Herbert Euler
2006-05-18  6:26                     ` Kenichi Handa
2006-05-18  6:40                       ` Herbert Euler
2006-05-19  3:01                   ` Herbert Euler
2006-05-18 17:35           ` Stefan Monnier
2006-05-19  2:49             ` Herbert Euler
2006-05-19 10:41               ` Eli Zaretskii

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).