summaryrefslogtreecommitdiff
path: root/lisp/net/net-utils.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2015-01-09 11:50:21 +0200
committerEli Zaretskii <eliz@gnu.org>2015-01-09 11:50:21 +0200
commit1f179ea1bac65d911c616dafbf7147f0dbb39afd (patch)
tree217af1921ff088ca1d3d6e02c5b54c940cb46801 /lisp/net/net-utils.el
parent70f298f88e84a5bfce26e3ff758157057a7948f3 (diff)
downloademacs-1f179ea1bac65d911c616dafbf7147f0dbb39afd.tar.gz
Fix encoding of I/O in net-utils.el for MS-Windows. (Bug#19458)
lisp/net/net-utils.el (net-utils-run-program, net-utils-run-simple): On MS-Windows, bind coding-system-for-read to the console output codepage.
Diffstat (limited to 'lisp/net/net-utils.el')
-rw-r--r--lisp/net/net-utils.el20
1 files changed, 18 insertions, 2 deletions
diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el
index 28aa43117da..ebcbc714ffb 100644
--- a/lisp/net/net-utils.el
+++ b/lisp/net/net-utils.el
@@ -328,7 +328,15 @@ This variable is only used if the variable
(defun net-utils-run-program (name header program args)
"Run a network information program."
- (let ((buf (get-buffer-create (concat "*" name "*"))))
+ (let ((buf (get-buffer-create (concat "*" name "*")))
+ (coding-system-for-read
+ ;; MS-Windows versions of network utilities output text
+ ;; encoded in the console (a.k.a. "OEM") codepage, which is
+ ;; different from the default system (a.k.a. "ANSI")
+ ;; codepage.
+ (if (eq system-type 'windows-nt)
+ (intern (format "cp%d" (w32-get-console-output-codepage)))
+ coding-system-for-read)))
(set-buffer buf)
(erase-buffer)
(insert header "\n")
@@ -352,7 +360,15 @@ This variable is only used if the variable
(when proc
(set-process-filter proc nil)
(delete-process proc)))
- (let ((inhibit-read-only t))
+ (let ((inhibit-read-only t)
+ (coding-system-for-read
+ ;; MS-Windows versions of network utilities output text
+ ;; encoded in the console (a.k.a. "OEM") codepage, which is
+ ;; different from the default system (a.k.a. "ANSI")
+ ;; codepage.
+ (if (eq system-type 'windows-nt)
+ (intern (format "cp%d" (w32-get-console-output-codepage)))
+ coding-system-for-read)))
(erase-buffer))
(net-utils-mode)
(setq-local net-utils--revert-cmd