emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116232: Fix bug #16448 with non-ASCII error message


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r116232: Fix bug #16448 with non-ASCII error messages in batch mode.
Date: Sat, 01 Feb 2014 11:54:09 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116232
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16448
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2014-02-01 13:53:10 +0200
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/print.c                    print.c-20091113204419-o5vbwnq5f7feedwu-262
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-02-01 09:22:51 +0000
+++ b/src/ChangeLog     2014-02-01 11:53:10 +0000
@@ -1,5 +1,9 @@
 2014-02-01  Eli Zaretskii  <address@hidden>
 
+       * 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)

=== modified file 'src/print.c'
--- a/src/print.c       2014-01-29 17:52:16 +0000
+++ b/src/print.c       2014-02-01 11:53:10 +0000
@@ -709,17 +709,36 @@
 to make it write to the debugging output.  */)
   (Lisp_Object character)
 {
+  unsigned int ch;
+
   CHECK_NUMBER (character);
-  putc (XINT (character) & 0xFF, stderr);
+  ch = XINT (character);
+  if (ASCII_CHAR_P (ch))
+    {
+      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
-  /* 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);
+      if (print_output_debug_flag)
+       OutputDebugString (SSDATA (encoded_ch));
+#endif
     }
-#endif
 
   return character;
 }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]