perl 5.8, utf8 and DBI

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

At first I must say I'm Perl5.6.1 user ;-)
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

use strict;
use LWP::UserAgent;
use Unicode::Lite;
use DBI;
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>

Site Timeline