perl-unicode

Re: Website encoding

2004-11-17 20:30:09
Hello,

Rick Measham wrote:
My thought process is to convert them into utf8 and store that in the
database. Then it's just a case of retrieving them later and outputting
them all on one page marked as utf8.

That being the case, I grab the charset and use Encode's decode function
to turn it into 'perl's internal format' .. which in 5.8.5 is utf8
right? I then store that in the db.

However it's not working.

Does that mean that the encoding of the actual characters on the page is
not in the charset in the meta tag? Or am I missing some piece of the
puzzle?

Please check this sample. Did you handle Perl's internal format in such
like manner?

#!/usr/local/bin/perl -w
use 5.008;
use strict;
use warnings;

use LWP::Simple;
my $uri = 'http://www.reitsport-schill.de/index1053542873.html';
my $remotedoc = get($uri);
$remotedoc =~ m/<title>(.*?)<\/title>/;
my $ISO_8859_1 = $1;

use Encode;
my $Perl_Internal = decode('ISO-8859-1', $ISO_8859_1);
my $UTF8 = encode('UTF8', $Perl_Internal);
print $UTF8;
__END__

-- 
Masanori HATA
<lovewing(_at_)dream(_dot_)big(_dot_)or(_dot_)jp>
He's always with us!

<Prev in Thread] Current Thread [Next in Thread>