]> sjero.net Git - wget/commitdiff
Introduce find_locale() to find out local system encoding.
authorSaint Xavier <wget@sxav.eu>
Thu, 19 Jun 2008 21:10:06 +0000 (23:10 +0200)
committerSaint Xavier <wget@sxav.eu>
Thu, 19 Jun 2008 21:10:06 +0000 (23:10 +0200)
src/ChangeLog
src/iri.c
src/iri.h
src/main.c

index e30990b028b62a977a7e6488cc7201a37478ba15..ef69dca6f18c4f5ed98d69942f3ac236edbcf079 100644 (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>
 
        * html-url.c : Add "content-type" meta tag parsing for
index e4f4622b404fa064ba3c8c06a07271e37df14737..797ffa44a6825f550333209b5c9b7f5684b45ff6 100644 (file)
--- a/src/iri.c
+++ b/src/iri.c
@@ -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 ();
+}
+
+
index 2ac7d5e77766f20a058a658f28c34367cad909bd..eb344d9fe1d3ef171597dfb5dd99d1f5f3d68b3e 100644 (file)
--- a/src/iri.h
+++ b/src/iri.h
@@ -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 */
index 8002c1be2a0303e08702fab8f4556665f4de5169..fc41153b2a862e774f37250e32721aff7dae538b 100644 (file)
@@ -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)