Hi, I moved some code from one server to another. The versions of perl, dbi and dbd-mysql changed.

old:

perl.x86_64 4:5.8.8-43.el5_11
perl-DBD-MySQL.x86_64 3.0007-2.el5
perl-DBI.x86_64 1.52-2.el5

new:

perl.x86_64 4:5.10.1-141.el6
perl-DBD-MySQL.x86_64 4.013-3.el6
perl-DBI.x86_64 1.609-4.el6

All the perl-Unicode modules are installed.

Data passes over the wire from mysql with unicode in it. For instance, my e-acute comes over the wire as two bytes, 0xC3 0xA9.

On the old server, it is printed as two bytes. On the new server, it is printed as one byte: E9. On the new server perl's length function reports the string as having the correct number of characters as a one-byte character.

Printing the line with Encode::encode_utf8 causes it to come out correctly, but this requires combing a multitude of code to ad the encode_utf8 statement.

I tried adding mysql_enable_utf8 => 1 to the collection of options in the DBI->connect line, with no luck.

How can I avoid combing the code for places to add the encode_utf8 function.

Thanks,

Ed Greenberg


In reply to UTF8 between versions by edgreenberg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.