On Saturday, February 25, 2006 at 21:06:19 +0100, Hrvoje Niksic wrote:

> Is the "current charset of the console" ever really different than the
> "default OEM charset"?

    They are identical by default. But the first can be changed in each
console window, while the later is fixed on a given Windows install.

> How does one change the console charset, anyway?

    Thru "chcp" command in a cmd.exe session, or thru a call to
SetConsoleCP() or SetConsoleOutputCP() in an app.

> the setlocale invocation should look like this:

    Hum... You dropped the fallback to ANSI when GetConsoleOutputCP()
returns 0. That's fine, if it's considered useless. But it could lead to
a setlocale(LC_ALL, ".0"), with unknown behaviour. Hopefully it then
fails, returning NULL, as it does in my setup. But I'm not sure it does
that in all setups.

> Wget is calling setlocale(LC_ALL, "") only if HAVE_NLS is defined,
> which is typically not the case on Windows, as HAVE_NLS implies
> existence of gettext, textdomain, and bindtextdomain.

    Also utils.c:get_grouping_data() does setlocale(LC_NUMERIC, "")
temporarily. For some platforms including Windows, doing LC_NUMERIC
alone is not guaranteed to have the desired effect. Example on Windows
the call with ".850" succeeds, but selects the default ANSI locale (or
whatever was set by LC_ALL).

    In fact it seems to me that all manipulations of a category alone,
outside of LC_ALL, are calling for problems on this or that platform.
Especially when the charsets are incompatible between categories (up to
segfaults, when cooperating with some buggy Glibc versions).

    Now, if the main setlocale(LC_ALL) is always called, I believe that
get_grouping_data() can be greatly simplified, dropping the
#ifdef LC_NUMERIC setlocale(LC_NUMERIC). And just calling localeconv()
if it exists.

> Testers able to compile Wget and reproduce this problem would be much
> appreciated.

    Beware: The default console font "Terminal" having only an "OEM/DOS"
script is unable to correctly follow "chcp" commands. A smarter font
like "Lucida Console" is better suited for testing.

Bye!    Alain.
When you want to reply to a mailing list, please avoid doing so with
Lotus Notes 5. This lacks necessary references and breaks threads.

Reply via email to