[ping] [PATCH] Different outputs affected by locale

Eli Zaretskii eliz@gnu.org
Mon Jun 16 15:40:00 GMT 2014


> Date: Mon, 16 Jun 2014 14:57:59 +0100
> From: Pedro Alves <palves@redhat.com>
> CC: yao@codesourcery.com, tromey@redhat.com, brobecker@adacore.com,
>         gdb-patches@sourceware.org
> 
> On 06/12/2014 07:34 PM, Eli Zaretskii wrote:
> 
> > With you so far.  But note that on Windows, even the above does not
> > guarantee "stable output", because the console codepage is not changed
> > by 'setlocale', 
> 
> I guess the harmness could run gdb under chcp 65001 or some such.

You could, but it won't help, really.  It's a long story, but support
for UTF-8 on a Windows console is pathetic.  With enough trouble
(which will need source changes in GDB and in Readline), you might
have European characters displayed correctly, if you also change the
console font to Lucida Console.  But anything beyond European
characters simply cannot be displayed, because the font doesn't have
them.

> > You cannot ask the Windows 'setlocale' to use UTF-8 as the codeset
> > (although there is a UTF-8 codepage, and Windows does support it in
> > general).  More importantly, since 'setlocale' on Windows disregards
> > the environment variables, you cannot change the host charset by
> > setting environment variables.  You must do that by a GDB command that
> > sets host-charset.
> 
> See https://sourceware.org/ml/gdb-patches/2014-06/msg00364.html .

If you mean the last 2 sentences, then yes, using setlocale from
gnulib will fix that.  But the problem with UTF-8 as the charset isn't
(and AFAIK cannot be) solved by gnulib, because Windows simply does
not support codepage 65001 in its setlocale implementation (this is
documented in MSDN).



More information about the Gdb-patches mailing list