On Apr 7, 2010, at 10:02 , Роман Николаев wrote:
> Hello. Please help me to use your module URI-1.54. I see for URI::_punycode
> package, but not understand how to use it.
> I need convert domain names from local to punycode.
>
> Example: "кофемашина.su" (some_russian_letters.su) to "xn--80aannhnjd8c2b.su"
>
> I try to:
>
> use URI;
> my $uri = URI->new("some_russian_letters.su", "http");
The problem here is that this actually set up the 'path' portion of the URL to
be the "some_russian_letters.su". The IDNA stuff only applies to the hostname
portion. An example that works (for me) is:
----------------------------------------%<-------------
#!perl -lw
use utf8;
use URI;
my $u = URI->new("http://кофемашина.su");
print $u->host;
----------------------------------------%<-------------
This prints "xn--80aannhnjd8c2b.su".
--Gisle
> my $a = $uri->canonical;
> or
> my $a = $uri->iri;
>
> but $a is not punycode encoded string, just standart uri encoding: some
> %xx%xx%xx%xx....su
>
> Can You get me example or link to example?
>
> --
>
> Roman V. Nikolaev
>
> mail: [email protected]
> icq: 198-364-657
> jabber: [email protected]
> site: http://www.rshadow.ru