Support for internationalized domain names (IDN)
Brought to you by:
gisle
I noticed that LWP::UserAgent doesn't work for URLs
such as http://www.bücher.de/ . I found that one way of
getting around that problem is by creating a subclass:
package LWP::UserAgent::IDN;
use base 'LWP::UserAgent';
use Net::IDN::Encode;
sub prepare_request {
my ($self, $request) = @_;
my $uri = $request->uri;
eval {
my $host = domain_to_ascii($uri->host);
$uri->host($host);
};
$request;
}
1;
__END__
Note that this requires the Net::IDN::Encode module and
its dependencies (including Unicode::String). There are
at least two other modules which could be used instead
of Net::IDN::Encode, but I tried this one and it works.
Perhaps a future version of the distribution could
include support for IDNs?
--
Ivan