diff options
| author | Eli Zaretskii | 2014-02-01 13:53:10 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2014-02-01 13:53:10 +0200 |
| commit | 9ef58a52ac97a160e2818e69e7cd146e52fbdacf (patch) | |
| tree | 572142e04cbf44d0e5452ca2372bd144ad0645ca | |
| parent | 2f31004a737e5443ba96fd60733e9eda818abfe2 (diff) | |
| download | emacs-9ef58a52ac97a160e2818e69e7cd146e52fbdacf.tar.gz emacs-9ef58a52ac97a160e2818e69e7cd146e52fbdacf.zip | |
Fix bug #16448 with non-ASCII error messages in batch mode.
src/print.c (Fexternal_debugging_output): If the argument character
is non-ASCII, encode it with the current locale's encoding before
writing the result to the terminal.
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/print.c | 33 |
2 files changed, 30 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8a8956bec31..6c52ad45be2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2014-02-01 Eli Zaretskii <eliz@gnu.org> | 1 | 2014-02-01 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * print.c (Fexternal_debugging_output): If the argument character | ||
| 4 | is non-ASCII, encode it with the current locale's encoding before | ||
| 5 | writing the result to the terminal. (Bug#16448) | ||
| 6 | |||
| 3 | * w32fns.c (Fw32_shell_execute): Don't call file-exists-p for | 7 | * w32fns.c (Fw32_shell_execute): Don't call file-exists-p for |
| 4 | DOCUMENT that is a "remote" file name, i.e. a file-handler exists | 8 | DOCUMENT that is a "remote" file name, i.e. a file-handler exists |
| 5 | for it. (Bug#16558) | 9 | for it. (Bug#16558) |
diff --git a/src/print.c b/src/print.c index 71fa30da93e..f6d2baa6cd1 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -709,17 +709,36 @@ You can call print while debugging emacs, and pass it this function | |||
| 709 | to make it write to the debugging output. */) | 709 | to make it write to the debugging output. */) |
| 710 | (Lisp_Object character) | 710 | (Lisp_Object character) |
| 711 | { | 711 | { |
| 712 | CHECK_NUMBER (character); | 712 | unsigned int ch; |
| 713 | putc (XINT (character) & 0xFF, stderr); | ||
| 714 | 713 | ||
| 715 | #ifdef WINDOWSNT | 714 | CHECK_NUMBER (character); |
| 716 | /* Send the output to a debugger (nothing happens if there isn't one). */ | 715 | ch = XINT (character); |
| 717 | if (print_output_debug_flag) | 716 | if (ASCII_CHAR_P (ch)) |
| 718 | { | 717 | { |
| 719 | char buf[2] = {(char) XINT (character), '\0'}; | 718 | putc (ch, stderr); |
| 720 | OutputDebugString (buf); | 719 | #ifdef WINDOWSNT |
| 720 | /* Send the output to a debugger (nothing happens if there isn't | ||
| 721 | one). */ | ||
| 722 | if (print_output_debug_flag) | ||
| 723 | { | ||
| 724 | char buf[2] = {(char) XINT (character), '\0'}; | ||
| 725 | OutputDebugString (buf); | ||
| 726 | } | ||
| 727 | #endif | ||
| 721 | } | 728 | } |
| 729 | else | ||
| 730 | { | ||
| 731 | unsigned char mbstr[MAX_MULTIBYTE_LENGTH]; | ||
| 732 | ptrdiff_t len = CHAR_STRING (ch, mbstr); | ||
| 733 | Lisp_Object encoded_ch = | ||
| 734 | ENCODE_SYSTEM (make_multibyte_string (mbstr, 1, len)); | ||
| 735 | |||
| 736 | fwrite (SSDATA (encoded_ch), SBYTES (encoded_ch), 1, stderr); | ||
| 737 | #ifdef WINDOWSNT | ||
| 738 | if (print_output_debug_flag) | ||
| 739 | OutputDebugString (SSDATA (encoded_ch)); | ||
| 722 | #endif | 740 | #endif |
| 741 | } | ||
| 723 | 742 | ||
| 724 | return character; | 743 | return character; |
| 725 | } | 744 | } |