From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Herbert Euler" Newsgroups: gmane.emacs.devel Subject: Fcall_process: wrong conversion Date: Mon, 15 May 2006 14:09:59 +0800 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: sea.gmane.org 1147673517 4013 80.91.229.2 (15 May 2006 06:11:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 15 May 2006 06:11:57 +0000 (UTC) Cc: herberteuler@hotmail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 15 08:11:53 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FfWJ3-0005L0-ER for ged-emacs-devel@m.gmane.org; Mon, 15 May 2006 08:11:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FfWJ2-0004kg-Kz for ged-emacs-devel@m.gmane.org; Mon, 15 May 2006 02:11:48 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FfWIs-0004kZ-0S for emacs-devel@gnu.org; Mon, 15 May 2006 02:11:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FfWIp-0004k3-96 for emacs-devel@gnu.org; Mon, 15 May 2006 02:11:36 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FfWIp-0004k0-4X for emacs-devel@gnu.org; Mon, 15 May 2006 02:11:35 -0400 Original-Received: from [64.4.26.38] (helo=hotmail.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FfWLA-0005Vk-R0 for emacs-devel@gnu.org; Mon, 15 May 2006 02:14:01 -0400 Original-Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sun, 14 May 2006 23:10:03 -0700 Original-Received: from 64.4.26.200 by by112fd.bay112.hotmail.msn.com with HTTP; Mon, 15 May 2006 06:09:59 GMT X-Originating-IP: [80.237.206.93] X-Originating-Email: [herberteuler@hotmail.com] X-Sender: herberteuler@hotmail.com Original-To: emacs-devel@gnu.org X-OriginalArrivalTime: 15 May 2006 06:10:03.0294 (UTC) FILETIME=[34758BE0:01C677E6] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:54490 Archived-At: 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/