Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^3: CPAN's versus Japanse as Unicode?

by haukex (Archbishop)
on Dec 11, 2022 at 12:50 UTC ( [id://11148736]=note: print w/replies, xml ) Need Help??

in reply to Re^2: CPAN's versus Japanse as Unicode?
in thread CPAN's versus Japanese as Unicode?

Thanks, though adding use utf8 does not affect the result

Yes, it does.

... the host name needs to remain human-readable. The goal is to extract the host name from the URI and the host name happens to be Japanese as Unicode, ...

Corion already pointed you to Net::IDN::Encode as one possibility.

use warnings;
use strict;
use utf8;
use open qw/:std :encoding(UTF-8)/;
use URI;
use Net::IDN::Encode qw/domain_to_unicode/;

my $href="https://マリウス.com/";
my $uri = URI->new($href);
my $domain = domain_to_unicode($uri->host);
print $domain,"\n";  # prints "マリウス.com"
  • Comment on Re^3: CPAN's versus Japanse as Unicode?

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11148736]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (2)
As of 2024-04-17 03:39 GMT
Find Nodes?
    Voting Booth?

    No recent polls found