Problems? Is your data what you think it is? | |
PerlMonks |
Re: Problems w/ encoding in terminalby rjt (Curate) |
on Aug 06, 2013 at 12:04 UTC ( [id://1048103]=note: print w/replies, xml ) | Need Help?? |
Provided you save your localization module with utf8 encoding, just include use utf8; in that module. See perlunicode, and Tom Christiansen's most excellent Stackoverflow answer on unicode. Here's an example you can work from:
Output: English: Hello, Russian: привет If you run this exact code with russian.pl encoded in utf8, and do not see the expected Cyrillic script, check your terminal settings and/or try another. Also beware if you are piping the output through other programs that are not aware of the encoding. russian.pl:
As a (sort-of) aside to your question, however, you might want to check out Locale::Maketext to save yourself the work of re-inventing a localization module.
use strict; use warnings; omitted for brevity.
In Section
Seekers of Perl Wisdom
|
|