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 15:20:47 +0100 Message-ID: <459918BF.503@gmail.com> References: <4597B981.9020506@gmail.com> <45987A73.6040702@gmail.com> <4598A548.7040702@gnu.org> 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 1167661274 10602 80.91.229.12 (1 Jan 2007 14:21:14 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 1 Jan 2007 14:21:14 +0000 (UTC) Cc: emacs-devel@gnu.org, Jason Rumney Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 01 15:21:12 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 1H1O2D-0007Do-NX for ged-emacs-devel@m.gmane.org; Mon, 01 Jan 2007 15:21:06 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H1O2D-0007Fj-1U for ged-emacs-devel@m.gmane.org; Mon, 01 Jan 2007 09:21:05 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H1O1y-0007CS-Kz for emacs-devel@gnu.org; Mon, 01 Jan 2007 09:20:50 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H1O1w-00079O-TM for emacs-devel@gnu.org; Mon, 01 Jan 2007 09:20:49 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H1O1w-00079C-Lm for emacs-devel@gnu.org; Mon, 01 Jan 2007 09:20:48 -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 1H1O1u-0002BA-Bo; Mon, 01 Jan 2007 09:20:46 -0500 Original-Received: from c83-254-145-24.bredband.comhem.se ([83.254.145.24]:63209 helo=[127.0.0.1]) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.63) (envelope-from ) id 1H1O1s-0004d7-56; Mon, 01 Jan 2007 15:20:45 +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 1H1O1s-0004d7-56. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1H1O1s-0004d7-56 95c49ae813c2c0352f7efd41423c8165 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:64600 Archived-At: Eli Zaretskii wrote: >> Date: Mon, 01 Jan 2007 06:08:08 +0000 >> From: Jason Rumney >> Cc: Eli Zaretskii , emacs-devel@gnu.org >> >> There is no absolute "correct", as a user may run any programs from the >> command-line, not just native Windows console programs, and their input >> files could be in any encoding. >> > > But the same problem exists on Unix, doesn't it? On a GNU/Linux > system I'm typing this, default-process-coding-system is set to > `(undecided . iso-latin-1)'. How about if we follow the same logic, > with the exception that we want to force EOL conversions to specific > values as w32-fns.el does now? That is, use undecided-dos for input > and CP-unix for output, where CP is whatever > w32-get-console-output-codepage returns. > Oh, it is a bit easy to mix in and out here. This is what I use for testing now: (shell-mode) (when (eq system-type 'windows-nt) (let* ((shell-file-name prog) (proc (get-buffer-process (current-buffer))) (fullprog (executable-find prog)) (cp-out (read (format "cp%s" (w32-get-console-output-codepage)))) (cp-out-dos (coding-system-change-eol-conversion cp-out 'dos)) (cp-out-unix (coding-system-change-eol-conversion cp-out 'unix)) (cp-in (read (format "cp%s" (w32-get-console-codepage)))) (cp-in-dos (coding-system-change-eol-conversion cp-in 'dos)) (cp-in-unix (coding-system-change-eol-conversion cp-in 'unix))) (cond ((w32-shell-dos-semantics) (set-process-coding-system proc cp-out-dos cp-in-unix)) ((string-match "/msys/" fullprog) (message "think it is MSYS...") (set-process-coding-system proc cp-out-dos 'undecided-unix)) ((string-match "/cygwin/" fullprog) (message "think it is Cygwin...") (set-process-coding-system proc cp-out-dos 'undecided-unix)) (t (message "unrecognized shell program: %s" fullprog)) ))))) buffer) Is this what you meant Eli? Nothing especially weird happens with this version. It works OK for cmdproxy. Cygwin and MSYS still can't handle Swedish characters. I guess there is nothing to do about that.