GNU bug report logs -
#16448
24.3; Messages from (error "...") with UTF-8 chars are printed wrongly in Emacs Lisp scripts
Previous Next
Reported by: Sergey Tselikh <stselikh <at> gmail.com>
Date: Wed, 15 Jan 2014 00:19:01 UTC
Severity: normal
Found in version 24.3
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #16 received at 16448-done <at> debbugs.gnu.org (full text, mbox):
> Date: Wed, 15 Jan 2014 17:35:43 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 16448 <at> debbugs.gnu.org, stselikh <at> gmail.com
>
> > Date: Wed, 15 Jan 2014 08:02:49 +0400
> > From: Dmitry Antipov <dmantipov <at> yandex.ru>
> > Cc: 16448 <at> debbugs.gnu.org
> >
> > 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);
>
> This will only work correctly in a UTF-8 locale. In the general case,
> we need to run the resulting multibyte sequence through ENCODE_SYSTEM,
> before writing it to stderr.
Done in trunk revision 116232.
This bug report was last modified 11 years and 170 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.