emacs-devel
[Top][All Lists]
Advanced

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

Fcall_process: wrong conversion


From: Herbert Euler
Subject: Fcall_process: wrong conversion
Date: Mon, 15 May 2006 14:09:59 +0800

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/





reply via email to

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