Skip Menu |
 

This queue is for tickets about the URI CPAN distribution.

Report information
The Basics
Id: 67615
Status: rejected
Priority: 0/
Queue: URI

People
Owner: Nobody in particular
Requestors: vadim [...] price.ru
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: punycode bug
Date: Wed, 20 Apr 2011 17:47:41 +0400
To: bug-uri [...] rt.cpan.org
From: Vadim Menshakov <vadim [...] price.ru>
Download (untitled) / with headers
text/plain 384b
incorrect punycode: # INCORRECT: cat domain.txt | iconv -t utf8 | perl -MURI -lne 'chomp; print URI->new($_)->canonical' http://xn--adl9opab4bsg0pbbbcbmfb.xn--ai3ub/ # CORRECT: cat domain.txt | iconv -t utf8 | perl -MURI::UTF8::Punycode -nle 'chomp; die unless m#^(http://)(.+?)(\.)(.+?)(/)$#; print $1 . puny_enc($2) . $3 . puny_enc($4) . $5;' http://xn--b1agaxleqp7a.xn--p1ai/
What's the domain name you try to encode (in UTF-8)?
Download (untitled) / with headers
text/plain 348b
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/
Subject: Re: [rt.cpan.org #67615] punycode bug
Date: Fri, 22 Apr 2011 13:20:43 +0400
To: bug-uri [...] rt.cpan.org
From: Vadim Menshakov <vadim [...] price.ru>
Download (untitled) / with headers
text/plain 696b
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
> <URL: https://rt.cpan.org/Ticket/Display.html?id=67615 > > > 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/ >


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.