mirror of
https://github.com/mirror/wget.git
synced 2025-01-21 09:41:06 +08:00
[svn] Explain the choice of only setting LC_MESSAGES more thoroughly.
This commit is contained in:
parent
db075536c3
commit
47ccb39924
28
src/main.c
28
src/main.c
@ -83,25 +83,27 @@ static RETSIGTYPE redirect_output_signal PARAMS ((int));
|
|||||||
|
|
||||||
const char *exec_name;
|
const char *exec_name;
|
||||||
|
|
||||||
/* Initialize I18N. The initialization amounts to invoking
|
/* Initialize I18N/L10N. That amounts to invoking setlocale, and
|
||||||
setlocale(), bindtextdomain() and textdomain().
|
setting up gettext's message catalog using bindtextdomain and
|
||||||
Does nothing if NLS is disabled or missing. */
|
textdomain. Does nothing if NLS is disabled or missing. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
i18n_initialize (void)
|
i18n_initialize (void)
|
||||||
{
|
{
|
||||||
/* If HAVE_NLS is defined, assume the existence of the three
|
/* HAVE_NLS implies existence of functions invoked here. */
|
||||||
functions invoked here. */
|
|
||||||
#ifdef HAVE_NLS
|
#ifdef HAVE_NLS
|
||||||
/* Set the current locale. */
|
/* Set the current locale. */
|
||||||
/* Here we use LC_MESSAGES instead of LC_ALL, for two reasons.
|
/* Where possible, sets only LC_MESSAGES and LC_CTYPE. Other
|
||||||
First, message catalogs are all of I18N Wget uses anyway.
|
categories, such as numeric, time, or collation, break code that
|
||||||
Second, setting LC_ALL has a dangerous potential of messing
|
parses data received from the network and relies on C-locale
|
||||||
things up. For example, when in a foreign locale, Solaris
|
behavior of libc functions. For example, Solaris strptime fails
|
||||||
strptime() fails to handle international dates correctly, which
|
to recognize English month names in non-English locales, which
|
||||||
makes http_atotm() malfunction. */
|
breaks http_atotm. Some implementations of fnmatch perform
|
||||||
#ifdef LC_MESSAGES
|
unwanted case folding in non-C locales. ctype macros, while they
|
||||||
|
were used, provided another example against LC_ALL. */
|
||||||
|
#if defined(LC_MESSAGES) && defined(LC_CTYPE)
|
||||||
setlocale (LC_MESSAGES, "");
|
setlocale (LC_MESSAGES, "");
|
||||||
setlocale (LC_CTYPE, "");
|
setlocale (LC_CTYPE, ""); /* safe because we use safe-ctype */
|
||||||
#else
|
#else
|
||||||
setlocale (LC_ALL, "");
|
setlocale (LC_ALL, "");
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user