]> sjero.net Git - wget/blobdiff - src/url.c
Make get_utf8_encode() directly aware of ugly_no_encode and remove get_ugly_no_encode()
[wget] / src / url.c
index 48b23d6c649cb208e23933ef8aa08ee58d999815..beaf0fb204e67c2941a03c6cad6d87cd11b3d2b5 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -671,10 +671,15 @@ url_parse (const char *url, int *error)
       goto error;
     }
 
-  if (opt.enable_iri)
+  if (opt.enable_iri && get_utf8_encode ())
     {
+      const char *new;
+      bool utf8_encode;
       url_unescape ((char *) url);
-      url = locale_to_utf8(url);
+      utf8_encode = remote_to_utf8 (url, &new);
+      set_utf8_encode (utf8_encode);
+      if (utf8_encode)
+        url = new;
     }
 
   url_encoded = reencode_escapes (url);
@@ -853,7 +858,7 @@ url_parse (const char *url, int *error)
 
   if (opt.enable_iri)
     {
-      char *new = idn_encode (u->host);
+      char *new = idn_encode (u->host, get_utf8_encode ());
       if (new)
         {
           xfree (u->host);