I just read the perldoc for utf8 and perlunitut, and I think that "use utf8" only tells perl that your script is in utf8. The literal Hebrew string is converted from the utf8 encoding of the text file to the internal perl representation of a string of unicode text.
To output it correctly, you probably need to do something like this:

use utf8;
use Encode;
print encode("utf8", "דוב");

That works for me on linux, where the terminal understands utf8. It will print the expected output both with and without the encode call, but without it it will give the same warning you received.

To get it to print utf8 on the windows console, this link may be useful:
http://superuser.com/questions/269818/change-default-code-page-of-windows-console-to-utf-8


On 11/28/2012 02: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)

Shmuel.


_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to