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.
This commit is contained in:
Eli Zaretskii 2014-02-01 13:53:10 +02:00
parent 2f31004a73
commit 9ef58a52ac
2 changed files with 31 additions and 8 deletions

View file

@ -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)

View file

@ -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;
}