diff options
| author | Eli Zaretskii | 2015-01-09 11:50:21 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-01-09 11:50:21 +0200 |
| commit | 1f179ea1bac65d911c616dafbf7147f0dbb39afd (patch) | |
| tree | 217af1921ff088ca1d3d6e02c5b54c940cb46801 | |
| parent | 70f298f88e84a5bfce26e3ff758157057a7948f3 (diff) | |
| download | emacs-1f179ea1bac65d911c616dafbf7147f0dbb39afd.tar.gz emacs-1f179ea1bac65d911c616dafbf7147f0dbb39afd.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/net/net-utils.el | 20 |
2 files changed, 24 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2a6c960c4be..8481dd1fcce 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2015-01-09 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * net/net-utils.el (net-utils-run-program, net-utils-run-simple): | ||
| 4 | On MS-Windows, bind coding-system-for-read to the console output | ||
| 5 | codepage. (Bug#19458) | ||
| 6 | |||
| 1 | 2015-01-08 Eli Zaretskii <eliz@gnu.org> | 7 | 2015-01-08 Eli Zaretskii <eliz@gnu.org> |
| 2 | 8 | ||
| 3 | * simple.el (line-move-visual): When converting X pixel coordinate | 9 | * simple.el (line-move-visual): When converting X pixel coordinate |
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 | |||
| 328 | 328 | ||
| 329 | (defun net-utils-run-program (name header program args) | 329 | (defun net-utils-run-program (name header program args) |
| 330 | "Run a network information program." | 330 | "Run a network information program." |
| 331 | (let ((buf (get-buffer-create (concat "*" name "*")))) | 331 | (let ((buf (get-buffer-create (concat "*" name "*"))) |
| 332 | (coding-system-for-read | ||
| 333 | ;; MS-Windows versions of network utilities output text | ||
| 334 | ;; encoded in the console (a.k.a. "OEM") codepage, which is | ||
| 335 | ;; different from the default system (a.k.a. "ANSI") | ||
| 336 | ;; codepage. | ||
| 337 | (if (eq system-type 'windows-nt) | ||
| 338 | (intern (format "cp%d" (w32-get-console-output-codepage))) | ||
| 339 | coding-system-for-read))) | ||
| 332 | (set-buffer buf) | 340 | (set-buffer buf) |
| 333 | (erase-buffer) | 341 | (erase-buffer) |
| 334 | (insert header "\n") | 342 | (insert header "\n") |
| @@ -352,7 +360,15 @@ This variable is only used if the variable | |||
| 352 | (when proc | 360 | (when proc |
| 353 | (set-process-filter proc nil) | 361 | (set-process-filter proc nil) |
| 354 | (delete-process proc))) | 362 | (delete-process proc))) |
| 355 | (let ((inhibit-read-only t)) | 363 | (let ((inhibit-read-only t) |
| 364 | (coding-system-for-read | ||
| 365 | ;; MS-Windows versions of network utilities output text | ||
| 366 | ;; encoded in the console (a.k.a. "OEM") codepage, which is | ||
| 367 | ;; different from the default system (a.k.a. "ANSI") | ||
| 368 | ;; codepage. | ||
| 369 | (if (eq system-type 'windows-nt) | ||
| 370 | (intern (format "cp%d" (w32-get-console-output-codepage))) | ||
| 371 | coding-system-for-read))) | ||
| 356 | (erase-buffer)) | 372 | (erase-buffer)) |
| 357 | (net-utils-mode) | 373 | (net-utils-mode) |
| 358 | (setq-local net-utils--revert-cmd | 374 | (setq-local net-utils--revert-cmd |