Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^6: print UTF-8 problem

by HelenCr (Monk)
on Feb 17, 2012 at 00:36 UTC ( #954363=note: print w/ replies, xml ) Need Help??


in reply to Re^5: print UTF-8 problem
in thread print UTF-8 problem

It seems that it's not a Perl problem. I have a wide-character text file that looks fine in Notepad ("UTF-8 encoding"), in Notepad++, and when I cut-and-paste into MS Word it looks fine too. But when I open a "DOS box" (Windows console) and go: "type file.txt", it prints gibberish.

And yes, I did all the recommendations for Unicode on Windows console: I opened the console using "cmd /u", I changed the font to Lucida, and I've entered: "chcp 65001".


Comment on Re^6: print UTF-8 problem
Re^7: print UTF-8 problem
by ikegami (Pope) on Feb 18, 2012 at 00:43 UTC

    If the file is UTF-8 and the chcp is 65001, it should work.

    What do you get from

    perl -CS -E"say map chr, 0x2660, 0x100;"

    You should get the following (like I do)

    ♠Ā

    Is cygwin involved at all? (e.g. Are you using the bash shell?)

    What do you expect to get instead of <╫╫╫╫│11>?

      @ikegami: There are two problems there: 1. The Windows Console font does not have many Unicode glyphs; and 2: Perl IO does not manage well with Windows console output buffering.
      It was solved using SourceForge's "Console" utility (aka "Console2"), and specifying "unix" for the output binmode.
      There is no need to use Cygwin.
Re^7: print UTF-8 problem
by nikosv (Hermit) on Feb 19, 2012 at 14:50 UTC
      @nikosv: I did that, and it helped. Many thanks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://954363]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2014-04-18 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (464 votes), past polls