[Israel.pm] Perl-TK frame - showing Gibberish instead of Hebrew / Arabic characters from UTF-8 Input file.

Oren Maurer meorero at gmail.com
Sun Jun 1 22:24:35 PDT 2008


Thanks.
It's OK, with:
       use utf8;
and:
	open(INFILE, '<:encoding(utf8)', "$inputfilename")

One small question:
The "use Encode qw{decode_utf8};" - is it equivalent of  "use utf8; " ??

Oren Maurer

2008/6/1 Shmuel Fomberg <semuelf at 012.net.il>:
> Hi Oren.
>
> To extend what Omer wrote, the string looks like hebrew in utf8, that
> was re-encoded to utf8.
> You will probably fix that by telling Perl that your string is already
> utf8. do this by either opening the file with a utf8 flag:
> open(my $fh, "< :utf8", $filename)
> or by "converting" specific strings to utf8 by:
> use Encode qw{decode_utf8};
> my $line = <$fh>;
> my $h_line = decode_utf8($line);
>
> Good luck.
> Shmuel.
>
> Omer Zak:
>> The gibberish looks as if the string from the text file was not decoded
>> (converted into an Unicode string).
>> I am not fluent in the Perl way of dealing with Unicode strings, so I
>> apologize for being unable to offer more specific advice.
>>
>> On Sun, 2008-06-01 at 12:43 +0300, Oren Maurer wrote:
>>> Hi all
>>> I'm trying my first steps with Perl/Tk.
>>>
>>> I want to read input text file and show the file contents on a frame.
>>>
>>> The input text file has Hebrew and / or Arabic characters.
>>> It is saved as UTF-8.
>>>
>>> The Latin characters are displayed Ok. But the Hebrew / Arabic
>>> characters are shown as Gibberish (I mean - those small 'x' and '[]'
>>> instead of real Hebrew).
>>>
>>> For example:
>>> 003134388 24633 H $$aכל ספוריו ×(c)ל ×(c)×ž×•× ×œ יוסף ×¢×'× ×•×Ÿ
>>>
>>> Instead of:
>>> 003134388 24633 H $$aכל ספוריו של שמואל יוסף עגנון
>>>
>>>
>>> What can I do??
>>
>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl
>



-- 
________________________________
 Oren Maurer
 http://www.meorero.org.il
 _______________________________
 # =======================|
 # Please avoid sending me Word |
 # or PowerPoint attachments |
 # =======================|
 # See: http://www.gnu.org/philosophy/no-word-attachments.html


More information about the Perl mailing list