Notes on unicode/utf8, CGI, DBI, mysql

J

Joost Diepenmaat

Petr Vileta said:
Good idea to sumarize possible problems - good page.
I can mention only that you can use this too

my $dbh = DBI->connect( <parameters>);
$dbh->do( "SET NAMES utf8");

That by itself won't guarantee that your data will be correctly
handled. DBD::mysql provides the mysql_enable_utf8 option for a
reason. You do need at least DBD::mysql 4.004 for it to work more or
less correctly, though.

To the original poster: don't worry too much about the experimental
status of the option. It might some day go away (IMO not very likely,
though) but it's the best method today for getting reasonable unicode
behaviour out of DBD::mysql. At worst, you may have to remove the option
some time in the future, but the behaviour it enables is likely to stay.
 
J

Joost Diepenmaat

kbin said:
I've written a small tutorial/guide on some of the issues I've come
across when trying to use unicode/utf8 in my LAMP stack and thought
I'd share them.

http://kbinstuff.googlepages.com/perl,unicodeutf8,cgi.pm,apache,mod_perla

I hope you will find it useful and please provide me with feedback.

Nice work. There are still some issues with straight DBD::mysql, even
using the lastest versions and using the enable_utf8 option. I've made
some remarks on that in reply to this post on perlmonks:

http://perlmonks.org/?node_id=620803

The most important bug/missing feature still outstanding is:
http://rt.cpan.org/Public/Bug/Display.html?id=25590

Basically, this means that data inserted into UTF8 columns *must* be
utf-8 encoded (note that you *must not* encode non-UTF8 column
data!). See the perlmonks link for more info.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top