Re: DBD::mysql and utf-8 problem
"Dwalu Z. Khasu" <[email protected]> Fri, 27 Jun 2008 07:36:56 -0400 (EDT)
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 27 Jun 2008, Helmut wrote:
=>Hi all,
=>
=>after looking for utf8 issues in this mailing list, i had the feeling,
=>there would be no problems concerning utf8 and the
=>DBD::mysql driver anymore.
=>
=>However i still have a problem. The (simplified) script:
=>
=>[..]
=>my $aeu = "\N{LATIN SMALL LETTER A WITH DIAERESIS}";
=>
=>my $dbh = DBI->connect ("DBI:mysql:test:localhost;mysql_enable_utf8=1",
=>"test");
=>my $text = $dbh->selectrow_array (qq (select ?), undef, $aeu);
=>
=>print qq (length $text = ), length $text, "\n";
=>$text = decode ("UTF-8", $text);
=>print qq (length decoded $text = ), length $text,"\n";
=>[..]
=>
=>results in =>
=>
=>length Ã? = 2
=>length decoded ä = 1
=>
=>on an iso-8859-1 console.
=>
=>
=>Questions:
=>Why does Perl not calculate the correct number of characters?
=>Does one (still) have to decode every string value received from the
=>DBD::mysql driver?
=>
=>
=>Thanks for any Help
=>
=>Hemut
=>
=>
Hello Hemut,
It's not a problem with the driver or perl. You need to configure the
server or connection to return your specific charset, else it defaults to
latin1 IIRC.
See: http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html
--
- Dwalu
.peace
--
I am an important person in this world -
Now is the most important time in my life -
My mistakes are my best teachers -
So I will be fearless.
- Student Creed
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/[email protected]