Re: [Bug-wget] wget IDN support

2011-06-29 Thread Giuseppe Scrivano
Thanks to have reported these problems.  I'll take a look at them in the
next few days.

Cheers,
Giuseppe



Merinov Nikolay kim.roa...@gmail.com writes:

 Current realisation of IDN support in wget not worked when system uses
 UTF-8 locale.

 Current realisation of function `url_parse' from src/url.c call
 `remote_to_utf8' from src/iri.c and set `iri-utf8_encode' to returned
 value.

 Function `remote_to_utf8' can return false in two cases:
 1. They can not convert string to UTF-8
 2. Source text is same as result text

 Second case appear when system use UTF-8 encoding.

 This can be fixed in several places:
 In src/url.c (url_parse) with adding comparing iri-orig_url with UTF-8
 In src/iri.c (remote_to_utf8) with removing if (!strcmp (str, *new))
   test at the end of function.
 Or in src/iri.c (remote_to_utf8) with replacing return status when
   result is same as input string.

 Last variant can be written like this:

 === modified file 'src/iri.c'
 --- src/iri.c 2011-01-01 12:19:37 +
 +++ src/iri.c 2011-06-23 16:34:10 +
 @@ -277,7 +277,7 @@
if (!strcmp (str, *new))
  {
xfree ((char *) *new);
 -  return false;
 +  *new = NULL;
  }
  
return ret;


 Also it can be a good idea to fix src/host.c(lookup_host) with replacing
 usage `gethostbyname_with_timeout' by `getaddrinfo_with_timeout' and
 using AI_IDN flag, if wget compiled with glibc version 2.3.4 or
 newer. It can be helpful when wget compiled without iri support.



[Bug-wget] wget IDN support

2011-06-23 Thread Merinov Nikolay
Current realisation of IDN support in wget not worked when system uses
UTF-8 locale.

Current realisation of function `url_parse' from src/url.c call
`remote_to_utf8' from src/iri.c and set `iri-utf8_encode' to returned
value.

Function `remote_to_utf8' can return false in two cases:
1. They can not convert string to UTF-8
2. Source text is same as result text

Second case appear when system use UTF-8 encoding.

This can be fixed in several places:
In src/url.c (url_parse) with adding comparing iri-orig_url with UTF-8
In src/iri.c (remote_to_utf8) with removing if (!strcmp (str, *new))
  test at the end of function.
Or in src/iri.c (remote_to_utf8) with replacing return status when
  result is same as input string.

Last variant can be written like this:

=== modified file 'src/iri.c'
--- src/iri.c   2011-01-01 12:19:37 +
+++ src/iri.c   2011-06-23 16:34:10 +
@@ -277,7 +277,7 @@
   if (!strcmp (str, *new))
 {
   xfree ((char *) *new);
-  return false;
+  *new = NULL;
 }
 
   return ret;


Also it can be a good idea to fix src/host.c(lookup_host) with replacing
usage `gethostbyname_with_timeout' by `getaddrinfo_with_timeout' and
using AI_IDN flag, if wget compiled with glibc version 2.3.4 or
newer. It can be helpful when wget compiled without iri support.