emacs-devel
[Top][All Lists]
Advanced

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

Re: Codepages and shell function on w32


From: Lennart Borgman (gmail)
Subject: Re: Codepages and shell function on w32
Date: Mon, 01 Jan 2007 15:20:47 +0100
User-agent: Thunderbird 1.5.0.9 (Windows/20061207)

Eli Zaretskii wrote:
Date: Mon, 01 Jan 2007 06:08:08 +0000
From: Jason Rumney <address@hidden>
Cc: Eli Zaretskii <address@hidden>, address@hidden

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.





reply via email to

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