(Unicode novice alert)

I have the string "Janáček, Leoš" in a Perl variable. The three accented characters should be a-acute, c-caron, and s-caron (looks like the Perlmonks app is converting my c-caron into an e-grave).

Using Unicode codepoints, this is:

my $str = "Jan\x{00E1}\x{010D}ek, Leo\x{0161}";

I want to process this so that it (a) displays correctly in a sufficiently-recent browser, and (b) is correctly encoded into a URL - specifically to construct a Google link to search for Janacek references.

I've figured out (a), but getting stuck on (b). If you cut&paste the string into Google, it turns it into "Janáček, Leoš" (which is fine, 269=0x010D). Hunting for modules that will generate a string that can be cleanly transmitted to Google via URL.

I've tried fooling with Unicode::String, HTML::Entities, and others. No luck so far. Suggestions appreciated.

It looks like a lot of sites have problems confusing c-caron and e-grave (codepoints 010D and 00E8). If you search Google for Janacek-with-e-grave, you'll get more results than for Janacek-with-c-caron. I have no idea why this is.

I'm setting charset=utf-8 everywhere: HTTP header, HTML HEAD meta tag, and FORM accept-charset attribute.

-Jason


In reply to Unicode, HTML, POST by jmay

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.