From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: Codepages and shell function on w32 Date: Mon, 01 Jan 2007 14:46:13 +0100 Message-ID: <459910A5.3000208@gmail.com> References: <4597B981.9020506@gmail.com> <45987A73.6040702@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1167659198 5716 80.91.229.12 (1 Jan 2007 13:46:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 1 Jan 2007 13:46:38 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 01 14:46:38 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H1NUr-0004oZ-9a for ged-emacs-devel@m.gmane.org; Mon, 01 Jan 2007 14:46:37 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H1NUq-0008Cv-G3 for ged-emacs-devel@m.gmane.org; Mon, 01 Jan 2007 08:46:36 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H1NUX-0008CP-Qt for emacs-devel@gnu.org; Mon, 01 Jan 2007 08:46:17 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H1NUV-0008By-OD for emacs-devel@gnu.org; Mon, 01 Jan 2007 08:46:17 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H1NUV-0008Bv-Lm for emacs-devel@gnu.org; Mon, 01 Jan 2007 08:46:15 -0500 Original-Received: from [80.76.149.212] (helo=ch-smtp01.sth.basefarm.net) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1H1NUT-0006wD-Ux; Mon, 01 Jan 2007 08:46:14 -0500 Original-Received: from c83-254-145-24.bredband.comhem.se ([83.254.145.24]:63171 helo=[127.0.0.1]) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.63) (envelope-from ) id 1H1NUR-0002Di-3F; Mon, 01 Jan 2007 14:46:12 +0100 User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) Original-To: Eli Zaretskii In-Reply-To: X-Antivirus: avast! (VPS 0666-1, 2006-12-31), Outbound message X-Antivirus-Status: Clean X-Scan-Result: No virus found in message 1H1NUR-0002Di-3F. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1H1NUR-0002Di-3F 93938f05141bcb0574a2ac7d6ddda0b7 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:64599 Archived-At: Eli Zaretskii wrote: >> Date: Mon, 01 Jan 2007 04:05:23 +0100 >> From: "Lennart Borgman (gmail)" >> CC: emacs-devel@gnu.org >> >> Eli Zaretskii wrote: >> >>>> Date: Sun, 31 Dec 2006 14:22:09 +0100 >>>> From: "Lennart Borgman (gmail)" >>>> >>>> (cp-out (read (format "cp%s" (w32-get-console-output-codepage)))) >>>> (cp-in (read (format "cp%s" (w32-get-console-codepage))))) >>>> (cond >>>> ((w32-shell-dos-semantics) >>>> (set-process-coding-system proc cp-out cp-in)) >>>> >>>> >>> This is wrong: w32-fns.el sets this as follows: >>> >>> (setq default-process-coding-system >>> (if default-enable-multibyte-characters >>> '(undecided-dos . undecided-unix) >>> '(raw-text-dos . raw-text-unix))) >>> >>> The output encoding uses *-unix for a good reason. >>> >> Can you please explain a bit more? How should it look? >> > > I meant the EOL conversion that you've left unspecified (i.e. open to > Emacs guesswork on input and subtle black magic on output). You need > to use coding-system-change-eol-conversion to force the car of the > cons cell use -dos, and the cdr to use -unix. > Thanks. Should the cmdproxy case look something like this then: (let ((shell-file-name prog) (proc (get-buffer-process (current-buffer))) (fullprog (executable-find prog)) (cp-out (coding-system-change-eol-conversion (read (format "cp%s" (w32-get-console-output-codepage))))) (cp-in (read (format "cp%s" (w32-get-console-codepage))))) (cond ((w32-shell-dos-semantics) (set-process-coding-system proc cp-out cp-in)) Should it be in defun shell? Is there a better way then (read (format ...)) to convert from integer to symbol here? > It's very easy to verify, if you have Cygwin programs installed, no? > Yes, both Cygwin and MSYS for testing. > >> What do I write to test with the C locale? >> > > I'd suggest the other way around: try to get a Cygwin program to work > correctly in a non-C locale. For example, `sort' should use the > correct sorting order with non-ASCII (Swedish) characters, `ls' should > display file names with correct Swedish characters, etc. > Both MSYS and Cygwin have troubles with Swedish characters in file names.