Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Testing for Chinese Characters

by ikegami (Patriarch)
on Jun 15, 2016 at 19:58 UTC ( [id://1165787]=note: print w/replies, xml ) Need Help??


in reply to Testing for Chinese Characters

First of all, what you call "MSDOS screen" is actually called a "Windows console", possibly running "the Windows command shell".


The message yo are getting indicates you are printing non-bytes to a handle expecting bytes. In this case, you are printing decoded text without telling Perl to encode it. You can use the following to do that:

use Win32 qw( ); BEGIN { binmode(STDIN, ':encoding(cp'. Win32::GetConsoleCP() .')'); binmode(STDOUT, ':encoding(cp'. Win32::GetConsoleOutputCP() .')'); binmode(STDERR, ':encoding(cp'. Win32::GetConsoleOutputCP() .')'); }

That said, I have doubts about the ability of your console to display Chinese characters. You might need to switch to the console's code page to 65001 (by using chcp 65001) and switch the console's font. That's not without issues.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-23 07:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found