1
0
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:
Saint Xavier 2008-06-19 23:10:06 +02:00
parent 13fec85566
commit 2baf323933
4 changed files with 23 additions and 11 deletions

View File

@ -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> 2008-06-19 Xavier Saint <wget@sxav.eu>
* html-url.c : Add "content-type" meta tag parsing for * html-url.c : Add "content-type" meta tag parsing for

View File

@ -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 ();
}

View File

@ -33,11 +33,12 @@ as that of the covered work. */
#ifdef ENABLE_IRI #ifdef ENABLE_IRI
char *parse_charset (char *str); char *parse_charset (char *str);
char *find_locale (void);
#else /* ENABLE_IRI */ #else /* ENABLE_IRI */
#define parse_charset(str) NULL #define parse_charset(str) NULL
#define find_locale() NULL
#endif /* ENABLE_IRI */ #endif /* ENABLE_IRI */
#endif /* IRI_H */ #endif /* IRI_H */

View File

@ -57,6 +57,7 @@ as that of the covered work. */
#include "convert.h" #include "convert.h"
#include "spider.h" #include "spider.h"
#include "http.h" /* for save_cookies */ #include "http.h" /* for save_cookies */
#include "iri.h"
#include <getopt.h> #include <getopt.h>
#include <getpass.h> #include <getpass.h>
@ -1067,17 +1068,11 @@ for details.\n\n"));
if (opt.enable_iri) if (opt.enable_iri)
{ {
if (!opt.locale) if (!opt.locale)
{ opt.locale = find_locale ();
opt.locale = getenv ("CHARSET");
if (opt.locale == NULL) /* sXXXav : check given locale and remote encoding */
opt.locale = nl_langinfo(CODESET);
} logprintf (LOG_VERBOSE, "Locale = %s\n", quote (opt.locale));
else
{
/* sXXXav : check given locale */
logprintf (LOG_VERBOSE, "Check the locale...\n");
}
} }
#else #else
if (opt.enable_iri || opt.locale || opt.encoding_remote) if (opt.enable_iri || opt.locale || opt.encoding_remote)