Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Petr Vileta
February 14, 2008, 5:32 pm
rate this thread
I'm reading some web pages coded in windows-1250 codepage and I store content
into MySQL table with utf-8 charset. Under Windows and Perl 5.6.1 all work as
expected, but I put my script to Linux hosting where Perl 5.8.x is running and
I got bad data in MySQL.
My main concept is this
require utf8 if($] > 5.006.001);
my $content = readweb($url); # content is in CP1250
$content = convert('CP1250', 'UTF8', $content) if($] > 5.006.001); # if Perl
# do something with $content and store part to $data
$data = convert(''CP1250', 'UTF8', $data) if($] <= 5.006.001); # if Perl 5.6
my $sth=$dbh->prepare("INSERT INTO test SET myfield=?");
$sth->execute($data) or die "Can't store";
What I do wrong? Please can anybody help me?
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail from
another non-spammer site please.)
Please reply to <petr AT practisoft DOT cz>