aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2012-07-29 21:27:35 +0300
committerEli Zaretskii2012-07-29 21:27:35 +0300
commit20ba0cb429e59716eeb84b0b6d828f675d53b1e2 (patch)
treec49301ae2755556ceae222f5b0cf2b9f5cc35181
parenta5dcc929862f6727c71db5e45d8750f8c322c53b (diff)
downloademacs-20ba0cb429e59716eeb84b0b6d828f675d53b1e2.tar.gz
emacs-20ba0cb429e59716eeb84b0b6d828f675d53b1e2.zip
Fix bug #12082 with non-ASCII output in Windows GUI sessions.
lisp/international/mule-cmds.el (set-locale-environment): Revert last change, since display-graphic-p returns nil when this function is called during startup. Instead... lisp/term/w32console.el (terminal-init-w32console): ...setup the keyboard and terminal encoding for TTY sessions here.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/international/mule-cmds.el41
-rw-r--r--lisp/term/w32console.el12
3 files changed, 37 insertions, 25 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 61ae993319a..a6fd9c3e0d3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12012-07-29 Eli Zaretskii <eliz@gnu.org>
2
3 * international/mule-cmds.el (set-locale-environment): Revert last
4 change, since display-graphic-p returns nil when this function is
5 called during startup. Instead...
6
7 * term/w32console.el (terminal-init-w32console): ...setup the
8 keyboard and terminal encoding for TTY sessions here. (Bug#12082)
9
12012-07-29 Juri Linkov <juri@jurta.org> 102012-07-29 Juri Linkov <juri@jurta.org>
2 11
3 * simple.el (goto-line): Don't display default line number in the 12 * simple.el (goto-line): Don't display default line number in the
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 0fbd6453c55..524840e05fd 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -2666,32 +2666,23 @@ See also `locale-charset-language-names', `locale-language-names',
2666 2666
2667 ;; On Windows, override locale-coding-system, 2667 ;; On Windows, override locale-coding-system,
2668 ;; default-file-name-coding-system, keyboard-coding-system, 2668 ;; default-file-name-coding-system, keyboard-coding-system,
2669 ;; terminal-coding-system with the appropriate codepages. 2669 ;; terminal-coding-system with system codepage.
2670 (when (boundp 'w32-ansi-code-page) 2670 (when (boundp 'w32-ansi-code-page)
2671 (let ((ansi-code-page-coding (intern (format "cp%d" w32-ansi-code-page))) 2671 (let ((code-page-coding (intern (format "cp%d" w32-ansi-code-page))))
2672 (oem-code-page-coding 2672 (when (coding-system-p code-page-coding)
2673 (intern (format "cp%d" (w32-get-console-codepage)))) 2673 (unless frame (setq locale-coding-system code-page-coding))
2674 (oem-code-page-output-coding 2674 (set-keyboard-coding-system code-page-coding frame)
2675 (intern (format "cp%d" (w32-get-console-output-codepage)))) 2675 (set-terminal-coding-system code-page-coding frame)
2676 ansi-cs-p oem-cs-p oem-o-cs-p) 2676 ;; Set default-file-name-coding-system last, so that Emacs
2677 (setq ansi-cs-p (coding-system-p ansi-code-page-coding)) 2677 ;; doesn't try to use cpNNNN when it defines keyboard and
2678 (setq oem-cs-p (coding-system-p oem-code-page-coding)) 2678 ;; terminal encoding. That's because the above two lines
2679 (setq oem-o-cs-p (coding-system-p oem-code-page-output-coding)) 2679 ;; will want to load code-pages.el, where cpNNNN are
2680 ;; Set the keyboard and display encoding to either the current 2680 ;; defined; if default-file-name-coding-system were set to
2681 ;; ANSI codepage of the OEM codepage, depending on whether 2681 ;; cpNNNN while these two lines run, Emacs will want to use
2682 ;; this is a GUI or a TTY frame. 2682 ;; it for encoding the file name it wants to load. And that
2683 (when ansi-cs-p 2683 ;; will fail, since cpNNNN is not yet usable until
2684 (unless frame (setq locale-coding-system ansi-code-page-coding)) 2684 ;; code-pages.el finishes loading.
2685 (when (display-graphic-p frame) 2685 (setq default-file-name-coding-system code-page-coding))))
2686 (set-keyboard-coding-system ansi-code-page-coding frame)
2687 (set-terminal-coding-system ansi-code-page-coding frame))
2688 (setq default-file-name-coding-system ansi-code-page-coding))
2689 (when oem-cs-p
2690 (unless (display-graphic-p frame)
2691 (set-keyboard-coding-system oem-code-page-coding frame)
2692 (set-terminal-coding-system
2693 (if oem-o-cs-p oem-code-page-output-coding oem-code-page-coding)
2694 frame)))))
2695 2686
2696 (when (eq system-type 'darwin) 2687 (when (eq system-type 'darwin)
2697 ;; On Darwin, file names are always encoded in utf-8, no matter 2688 ;; On Darwin, file names are always encoded in utf-8, no matter
diff --git a/lisp/term/w32console.el b/lisp/term/w32console.el
index d52a4e68932..ceaa936e79b 100644
--- a/lisp/term/w32console.el
+++ b/lisp/term/w32console.el
@@ -52,6 +52,18 @@
52 "Terminal initialization function for w32 console." 52 "Terminal initialization function for w32 console."
53 ;; Share function key initialization with w32 gui frames 53 ;; Share function key initialization with w32 gui frames
54 (x-setup-function-keys (selected-frame)) 54 (x-setup-function-keys (selected-frame))
55 ;; Set terminal and keyboard encodings to the current OEM codepage.
56 (let ((oem-code-page-coding
57 (intern (format "cp%d" (w32-get-console-codepage))))
58 (oem-code-page-output-coding
59 (intern (format "cp%d" (w32-get-console-output-codepage))))
60 oem-cs-p oem-o-cs-p)
61 (setq oem-cs-p (coding-system-p oem-code-page-coding))
62 (setq oem-o-cs-p (coding-system-p oem-code-page-output-coding))
63 (when oem-cs-p
64 (set-keyboard-coding-system oem-code-page-coding)
65 (set-terminal-coding-system
66 (if oem-o-cs-p oem-code-page-output-coding oem-code-page-coding))))
55 (let* ((colors w32-tty-standard-colors) 67 (let* ((colors w32-tty-standard-colors)
56 (color (car colors))) 68 (color (car colors)))
57 (tty-color-clear) 69 (tty-color-clear)