in reply to perl writing urf8/utf16 output to cmd screen and html page

G'day msinfo,

When posting Unicode, it's best to use <pre>...</pre> or <tt>...</tt> tags instead of <code>...</code> or <c>...</c> tags. Here's an example:

$ perl -Mstrict -Mwarnings -le '
    use utf8;
    binmode STDOUT => ":utf8";
    print "एचटीएमल";
'
एचटीएमल

Can you run that code on your command-line? [I don't use Perl on MSWin but I believe you'll need to swap the single- and double-quotes.] What output do you get?

The entity references also render correctly as normal text (at least for me). With this markup:

<p>&#2319;&#2330;&#2335;&#2368;&#2319;&#2350;&#2354;</p>

I get this:

एचटीएमल

How does that look in your browser?

[I'm unfamiliar with this script. You say it's "devnagri". I search for this; couldn't find it; the search engine suggested "Devanagari". Is that what you meant?]

-- Ken

Replies are listed 'Best First'.
Re^2: perl writing urf8/utf16 output to cmd screen and html page
by msinfo (Sexton) on Sep 01, 2013 at 13:44 UTC
    There seems another problem, to write Unicode character, when I change encoding in notepad++ to Unicode, the web page doesn't renders in browser, and when I switch back to ANSI, it renders properly, but then I can't write Unicode characters