Notes on unicode/utf8, CGI, DBI, mysql

Discussion in 'Perl Misc' started by kbin, Mar 6, 2008.

  1. kbin

    kbin Guest

    kbin, Mar 6, 2008
    #1
    1. Advertising

  2. "Petr Vileta" <> writes:

    > 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.

    --
    Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
     
    Joost Diepenmaat, Mar 6, 2008
    #2
    1. Advertising

  3. kbin <> writes:

    > 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.

    --
    Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
     
    Joost Diepenmaat, Mar 6, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bjorn Jensen
    Replies:
    0
    Views:
    1,246
    Bjorn Jensen
    Mar 22, 2005
  2. SteveM
    Replies:
    5
    Views:
    1,629
    Mark Rae [MVP]
    Aug 28, 2007
  3. Paul Vudmaska

    dbi:mysql mysql has gone away

    Paul Vudmaska, Apr 21, 2004, in forum: Ruby
    Replies:
    0
    Views:
    125
    Paul Vudmaska
    Apr 21, 2004
  4. Jerome Hauss
    Replies:
    0
    Views:
    188
    Jerome Hauss
    Oct 13, 2004
  5. gry
    Replies:
    2
    Views:
    823
    Alf P. Steinbach
    Mar 13, 2012
Loading...

Share This Page