mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Introduce find_locale() to find out local system encoding.
This commit is contained in:
parent
13fec85566
commit
2baf323933
@ -1,3 +1,10 @@
|
||||
2008-06-19 Xavier Saint <wget@sxav.eu>
|
||||
|
||||
* iri.c, iri.h : Add a new function find_locale() to find
|
||||
out the local system encoding.
|
||||
|
||||
* main.c : Make use of find_locale().
|
||||
|
||||
2008-06-19 Xavier Saint <wget@sxav.eu>
|
||||
|
||||
* html-url.c : Add "content-type" meta tag parsing for
|
||||
|
@ -68,3 +68,12 @@ parse_charset (char *str)
|
||||
}
|
||||
|
||||
|
||||
/* Find the locale used, or fall back on a default value */
|
||||
char *
|
||||
find_locale (void)
|
||||
{
|
||||
/* sXXXav, made our own function or use libidn one ?! */
|
||||
return stringprep_locale_charset ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,11 +33,12 @@ as that of the covered work. */
|
||||
#ifdef ENABLE_IRI
|
||||
|
||||
char *parse_charset (char *str);
|
||||
|
||||
char *find_locale (void);
|
||||
|
||||
#else /* ENABLE_IRI */
|
||||
|
||||
#define parse_charset(str) NULL
|
||||
#define find_locale() NULL
|
||||
|
||||
#endif /* ENABLE_IRI */
|
||||
#endif /* IRI_H */
|
||||
|
15
src/main.c
15
src/main.c
@ -57,6 +57,7 @@ as that of the covered work. */
|
||||
#include "convert.h"
|
||||
#include "spider.h"
|
||||
#include "http.h" /* for save_cookies */
|
||||
#include "iri.h"
|
||||
|
||||
#include <getopt.h>
|
||||
#include <getpass.h>
|
||||
@ -1067,17 +1068,11 @@ for details.\n\n"));
|
||||
if (opt.enable_iri)
|
||||
{
|
||||
if (!opt.locale)
|
||||
{
|
||||
opt.locale = getenv ("CHARSET");
|
||||
opt.locale = find_locale ();
|
||||
|
||||
if (opt.locale == NULL)
|
||||
opt.locale = nl_langinfo(CODESET);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* sXXXav : check given locale */
|
||||
logprintf (LOG_VERBOSE, "Check the locale...\n");
|
||||
}
|
||||
/* sXXXav : check given locale and remote encoding */
|
||||
|
||||
logprintf (LOG_VERBOSE, "Locale = %s\n", quote (opt.locale));
|
||||
}
|
||||
#else
|
||||
if (opt.enable_iri || opt.locale || opt.encoding_remote)
|
||||
|
Loading…
Reference in New Issue
Block a user