[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] Patch: Fix printing mutibyte characters as unprintable ch
From: |
YX Hao |
Subject: |
Re: [Bug-wget] Patch: Fix printing mutibyte characters as unprintable characters on Windows |
Date: |
Mon, 6 Nov 2017 18:56:57 +0800 |
Hi Eli,
I will offer you some new information. Hope you can find out what you want.
1. GetConsoleOutputCP does return the same value as _getmbcp. Refer to
'setlocale_getCP.png'.
2. Use GetConsoleOutputCP or _getmbcp?
If you provide a code page value of UTF-7 or UTF-8, setlocale will fail:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-w
setlocale
chcp 65001
GetConsoleOutputCP: 65001
_getmbcp: 936
Example:
https://sourceforge.net/p/gnuplot/feature-requests/415/#e581
3. Go into 'vsnprintf' (VASNPRINTF) of gnulib. Refer to
'setlocale_getCP.png'.
4. Go into 'setlocale' of MS crt. 'Setlocale(LC_ALL, ".0")' should trigger
error and then leave the locale unchanged. Refer to
'msvcrt-setlocale-fallback.png'.
Best Regards,
YX Hao
> -----Original Message-----
> From: Eli Zaretskii [mailto:address@hidden
> Sent: 2017年11月5日 23:43
> To: YX Hao <address@hidden>
> Cc: address@hidden
> Subject: Re: [Bug-wget] Patch: Fix printing mutibyte characters as
unprintable
> characters on Windows
>
> > From: "YX Hao" <address@hidden>
> > Cc: <address@hidden>
> > Date: Sun, 5 Nov 2017 23:01:22 +0800
> >
> > >> '_getmbcp' is used
> > > Maybe the problem is that the codepage used for the console output
> > > is different from the system's ANSI codepage? What does
> > > GetConsoleOutputCP return in the case you describe?
> > >
> > > What happens if ENABLE_NLS is defined? Your patch only handles the
> > > situation where ENABLE_NLS is NOT defined.
> >
> > Yes, my patch only handles the situation I meet with, by using
> > necessary predefined conditions. I leave the others untouched, because
> > I don't have the needed libraries.
> > I hope others who has the environments can test it and turn on the
> > switches when necessary.
> >
> > And I can tell you that 'GetConsoleOutputCP' returns the codepage as
> > command 'chcp'. It is right. The gnu 'vsnprintf' doesn't work right with
> 'setlocale'
> > omitted.
>
> Sorry, I don't follow. Does GetConsoleOutputCP return the same value as
> _getmbcp, or does it return a different value?
setlocale_getCP.PNG
Description: PNG image
gnulib_VASNPRINTF.PNG
Description: PNG image
msvcrt-setlocale-fallback.png
Description: PNG image