bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#16448: 24.3; Messages from (error "...") with UTF-8 chars are printe


From: Dmitry Antipov
Subject: bug#16448: 24.3; Messages from (error "...") with UTF-8 chars are printed wrongly in Emacs Lisp scripts
Date: Wed, 15 Jan 2014 08:02:49 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 01/15/2014 04:10 AM, Sergey Tselikh wrote:

In a script, when (error "...") instruction is executed with some UTF-8
characters in its text, the message is not printed correctly.

In batch mode, (error ...) is handled by external-debugging-output, and the
latter just does:

putc (XINT (character) & 0xFF, stderr);
                       ^^^^^^
To allow multibyte sequences here, we should use something like:

=== modified file 'src/print.c'
--- src/print.c 2014-01-01 07:43:34 +0000
+++ src/print.c 2014-01-15 03:55:39 +0000
@@ -709,8 +709,14 @@
 to make it write to the debugging output.  */)
   (Lisp_Object character)
 {
+  unsigned char str[MAX_MULTIBYTE_LENGTH];
+  unsigned int ch;
+  ptrdiff_t len;
+
   CHECK_NUMBER (character);
-  putc (XINT (character) & 0xFF, stderr);
+  ch = XINT (character);
+  len = CHAR_STRING (ch, str);
+  fwrite (str, len, 1, stderr);

 #ifdef WINDOWSNT
   /* Send the output to a debugger (nothing happens if there isn't one).  */

Dmitry






reply via email to

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