[Israel.pm] Hebrew strings in perl

Stefan Hornburg (Racke) racke at linuxia.de
Wed Nov 28 04:42:28 PST 2012


On 11/28/2012 01:39 PM, Shmuel Fomberg wrote:
> On Wed, Nov 28, 2012 at 9:05 PM, Dov Levenglick wrote:
> 
>> I haven't tried printing Hebrew strings in Perl yet, I seem to recall a
>> talk last YAPC and only having to add use utf8;
>>
>> use utf8;
>> print "דוב";
>>
>> why does this produce the following:
>> Wide character in print at Desktop\test.pl line 2.
>> דוב
>>
> 
> Perl is pushing unicode into th concole. (and that is why it warns)
> however, on Windows, the default concole box does not know how to handle
> unicode.
> So you either need to install a dos box that do know how to display
> unicode, or figure out which encoding your concole is displaying and encode
> the text to that before printing.
> (or just push a layer to stdout using binmode)

That's wrong, as you get same error on Debian with UTF-8 console.
And it is a Perl warning.

This should work:

use utf8;
binmode(STDOUT, ':utf8');
print "דוב";

Regards
	Racke


-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team



More information about the Perl mailing list