Hello,
You want domain_to_unicode from Net::IDN::Encode, I believe.
#!/usr/bin/perl use utf8; use open ':std', ':encoding(UTF-8)'; use URI; use Net::IDN::Encode 'domain_to_unicode'; use strict; use warnings; my $href="https://マリウス.com/"; print $href,"\n"; my $uri = URI->new($href); my $punycode = $uri->host; print ":",$punycode,"\n"; my $domain = domain_to_unicode($punycode); print $domain, "\n"; exit(0); |
Output:
https://マリウス.com/ :xn--gckvb8fzb.com マリウス.com |
Hope this helps!
Edit: ++haukex posted while I was composing my reply
In reply to Re: CPAN's URI.pm versus Japanese as Unicode?
by 1nickt
in thread CPAN's URI.pm versus Japanese as Unicode?
by mldvx4
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |