From 40b33be830310726048dddaee3fdfba5c8a3480f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 1 Jun 2015 18:17:28 +0300 Subject: [PATCH] MS-Windows followup for batch stdout/stderr output changes * lisp/international/mule-cmds.el (set-locale-environment): In batch mode, use console codepages for keyboard and terminal encoding. (Bug#20545) --- lisp/international/mule-cmds.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index c8cd76f5eb1..474806d204e 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -2688,14 +2688,22 @@ See also `locale-charset-language-names', `locale-language-names', ;; On Windows, override locale-coding-system, ;; default-file-name-coding-system, keyboard-coding-system, - ;; terminal-coding-system with system codepage. + ;; terminal-coding-system with the ANSI or console codepage. (when (and (eq system-type 'windows-nt) (boundp 'w32-ansi-code-page)) - (let ((code-page-coding (intern (format "cp%d" w32-ansi-code-page)))) + (let* ((code-page-coding + (intern (format "cp%d" (if noninteractive + (w32-get-console-codepage) + w32-ansi-code-page)))) + (output-coding + (if noninteractive + (intern (format "cp%d" (w32-get-console-output-codepage))) + code-page-coding))) (when (coding-system-p code-page-coding) + (or output-coding (setq output-coding code-page-coding)) (unless frame (setq locale-coding-system code-page-coding)) (set-keyboard-coding-system code-page-coding frame) - (set-terminal-coding-system code-page-coding frame) + (set-terminal-coding-system output-coding frame) (setq default-file-name-coding-system code-page-coding)))) (when (eq system-type 'darwin) -- 2.39.5