diff options
-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 @@ 2014-02-01 Eli Zaretskii <eliz@gnu.org> + * 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. (Bug#16448) + * w32fns.c (Fw32_shell_execute): Don't call file-exists-p for DOCUMENT that is a "remote" file name, i.e. a file-handler exists 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 to make it write to the debugging output. */) (Lisp_Object character) { - CHECK_NUMBER (character); - putc (XINT (character) & 0xFF, stderr); + unsigned int ch; -#ifdef WINDOWSNT - /* Send the output to a debugger (nothing happens if there isn't one). */ - if (print_output_debug_flag) + CHECK_NUMBER (character); + ch = XINT (character); + if (ASCII_CHAR_P (ch)) { - char buf[2] = {(char) XINT (character), '\0'}; - OutputDebugString (buf); + putc (ch, stderr); +#ifdef WINDOWSNT + /* Send the output to a debugger (nothing happens if there isn't + one). */ + if (print_output_debug_flag) + { + char buf[2] = {(char) XINT (character), '\0'}; + OutputDebugString (buf); + } +#endif } + else + { + unsigned char mbstr[MAX_MULTIBYTE_LENGTH]; + ptrdiff_t len = CHAR_STRING (ch, mbstr); + Lisp_Object encoded_ch = + ENCODE_SYSTEM (make_multibyte_string (mbstr, 1, len)); + + fwrite (SSDATA (encoded_ch), SBYTES (encoded_ch), 1, stderr); +#ifdef WINDOWSNT + if (print_output_debug_flag) + OutputDebugString (SSDATA (encoded_ch)); #endif + } return character; } |