lev has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

My problem may be quite simple.
I applied the following test script to the perl module:
‘Locale- Hebrew-1.04’, http://search.cpan.org/~autrijus/Locale-Hebrew-1.04/Hebrew.pm

Is something missing or obviously wrong?
Are there any clues in the output, i.e. only the numbers(\5e9\5dc\5d5\5dd\20\31\32\33 = \ם\ו\ל\ש\space\1\2\3) compute?

#!/usr/local/bin/perl -w # # This program demonstrates Locale::Hebrew v1.04 support for UNICODE # (use Perl 5.8 and above) use Locale::Hebrew 1.04; use locale; eval (' use 5.8.3; use encoding utf8; my $msg= "\x{5e9}\x{5dc}\x{5d5}\x{5dd}\x20\x31\x32\x33"; print "Original utf8: ",$msg, "\n"; my $new_msg = hebrewflip($msg); print "Result utf8: ","$new_msg", "\n"; '); print $@ if $@; ------------------------------- Output: Original utf8: �©��� Result utf8: 123 ��©
*actually, my output presents an empty square in place of "&65533", which, if written correctly comes out here as "�" (interesting?)

Much thanks for any guidance

Replies are listed 'Best First'.
Re: Unicode (Hebrew) Module
by ikegami (Patriarch) on Apr 05, 2009 at 22:19 UTC
    use encoding is problematic. If you have UTF-8 source code, you want use utf8;.

    U+FFFD is used when a decoder encounters bad input.

    The module says "The input string is assumed to be in iso-8859-8 encoding by default." What you are passing it is not encoded using iso-8859-8. It's not encoded at all, in fact.

Re: Unicode (Hebrew) Module
by Anonymous Monk on Apr 05, 2009 at 15:45 UTC
    You have some typos (extra ':') and you're missing
    print "Original utf8: ", unpack('H*', $msg),"\b"; print "Result utf8: ", unpack('H*', "$new_msg"), "\n";