#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
use Encode qw/ is_utf8 /;
my $agent = LWP::UserAgent->new();
print "Content-type: text/html; charset=utf-8\n\n";
##two websites using Thai fonts
my @tests = (
'http://www.ranks.nl/images/test/intrend4kids.htm',
'http://www.readyplanet.com/',
);
foreach my $uri (@tests) {
eval {
printf "test: %s
", $uri;
my $response = $agent->get($uri);
my $dc = $response->decoded_content( raise_error => 1 );
printf "is decoded content utf8? %s
", is_utf8($dc);
print qq~
~;
};
if ($@) {
print "decode failed: $@\n";
}
print "\n";
}