X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=src%2Furl.c;h=32de9c751fdc358e94ed9422d2d191493b7a0949;hp=48b23d6c649cb208e23933ef8aa08ee58d999815;hb=9a2ea3938d09643c6528c3b83b1db4c30f47d981;hpb=6c6e838338c31f1ac3c57c71e4ac34c0401bdf86 diff --git a/src/url.c b/src/url.c index 48b23d6c..32de9c75 100644 --- a/src/url.c +++ b/src/url.c @@ -641,7 +641,7 @@ static const char *parse_errors[] = { error, and if ERROR is not NULL, also set *ERROR to the appropriate error code. */ struct url * -url_parse (const char *url, int *error) +url_parse (const char *url, int *error, bool *utf8_encode) { struct url *u; const char *p; @@ -671,10 +671,13 @@ url_parse (const char *url, int *error) goto error; } - if (opt.enable_iri) + if (opt.enable_iri && *utf8_encode) { + const char *new; url_unescape ((char *) url); - url = locale_to_utf8(url); + *utf8_encode = remote_to_utf8 (url, &new); + if (*utf8_encode) + url = new; } url_encoded = reencode_escapes (url); @@ -853,7 +856,7 @@ url_parse (const char *url, int *error) if (opt.enable_iri) { - char *new = idn_encode (u->host); + char *new = idn_encode (u->host, *utf8_encode); if (new) { xfree (u->host);