I think the issue is simply that you fails to provide a proper Unicode string to the URI->new() constructor. You would need to Encode::decode("UTF-8", $_) the string you read from
the file.
$ perl -MURI -MEncode -le 'print URI->new(encode_utf8(URI->new("http://xn--b1agaxleqp7a.xn--p1ai/")->as_iri))'
http://xn--adl9opab4bsg0pbbbcbmfb.xn--ai3ub/
You are right, it works this way:
cat domain.txt | iconv -t utf8 | perl -MEncode -MURI -lne 'chomp; print URI->new(Encode::decode("utf8", $_))->canonical'
http://xn--b1agaxleqp7a.xn--p1ai/
Now I see. Thank you!
On Friday 22 April 2011 00:24:27 Gisle_Aas via RT wrote:
Show quoted text