The point about the source code is to do with your test code. What ends up in the database depends on a) the encoding of the source file and b) the locale your perl runs under. If Perl assumes the source is in a locale-specific 8-bit encoding, it will take the string’s bytes verbatim from the source code and put them in a non-UTF-8 string. Which means the bytes you have in your source would end up in the database.

But it’s a different question what happens when you stuff user input there. That too depends on what locale Perl is running under (mostly, whether it’s UTF-8), but the other factor is which encoding the user’s input had, which is clearly not necessarily the same as the encoding of your source code.

And whether entering text directly into the database from the console works correctly depends on what encoding your terminal emulator produces your input as, and what locale the commandline database utility runs under.

(Can you tell why I so wish everything was UTF-8 already? Layers upon layers, this is an onion of opportunities to screw up…)

Makeshifts last the longest.


In reply to Re^3: Perl Character Set by Aristotle
in thread Perl Character Set by indiansummersky

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.