This node by Nik confused me greatly.

Apparently, if you post unicode characters in a <code> block, you see the numeric HTML entities instead of the characters. I expect this is due to some kind of double encoding bug.

Example:

Here are some random unicode characters I randomly selected:

حيض,πβΫ

Here are the same characters in a <pre> block:

حيض,πβΫ

And here are the same characters in a <code> block:

&#1581;&#1610;&#1590;,&#960;&#946;&#939;

Note that I didn't use any HTML numeric references myself - I just copy/paste the characters from the gnome "charmap" program into the textfield.

Below is the relevant part of the HTML source to this page:

<p> Here are some random unicode characters I randomly selected: <p> &#1581;&#1610;&#1590;,&#960;&#946;&#939; </p> Here are the same characters in a <tt class='inlinecode'>&lt;pre&gt;</ +tt> block: <p> <pre>&#1581;&#1610;&#1590;,&#960;&#946;&#939;</pre> <p> And here are the same characters in a <tt class='inlinecode'>&lt;code& +gt;</tt> block: <p> <pre class="code"><div class='codeblock'><tt class='codetext'>&amp;#15 +81;&amp;#1610;&amp;#1590;,&amp;#960;&amp;#946;&amp;#939; </tt></div></pre>

As you can see, in the <code> block, the numeric entitie's & chars are incorrectly escaped. I think is is a pretty serious issue now that perl can handle native utf8 source.

Also, I notice that these characters are also doubly escaped in the textarea field that I'm typing in now (i.e. you can enter unicode chars in the textfield, but at preview, in the textfield, you'll just see a bunch of &#number; entries).


In reply to Unicode characters in <code> blocks by Joost

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.