bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] wget IDN support


From: Merinov Nikolay
Subject: [Bug-wget] wget IDN support
Date: Thu, 23 Jun 2011 23:37:16 +0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

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 +0000
+++ src/iri.c   2011-06-23 16:34:10 +0000
@@ -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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]