Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: pp module messes encoding

by GrandFather (Saint)
on May 13, 2011 at 23:41 UTC ( [id://904761]=note: print w/replies, xml ) Need Help??


in reply to pp module messes encoding

What does "(tried & failed to convert with some functions from the utf8 pragma )" mean?

How about writing a small stand alone script that demonstrates the issue? That may mean embedding problematic text in the script. See I know what I mean. Why don't you?.

True laziness is hard work

Replies are listed 'Best First'.
Re^2: pp module messes encoding
by palkia (Monk) on May 14, 2011 at 00:33 UTC
    It means: that I tried to convert the text result with:
    utf8::encode, utf8::decode, utf8::upgrade, & utf8::downgrade,
    and none converted the extracted text with the .exe version, to what was extracted in the .pl version.

    umm.. that was the script.
    I can't demonstrate the problem with a shorter script, because the Hebrew characters can't be shown right without my writeFile function, since Padre (or perl, not sure) doesn't support utf8 chars (like Hebrew chars) by default.

      The following works fine for me in a utf8 savy console (Komodo output window actually):

      use strict; use warnings; use utf8; my $str = 'עוד להיט'; binmode STDOUT, ":encoding(utf8)"; print $str;

      It's important to note that whatever is rendering your script output must be capable of handling whatever unicode characters you throw at it. If this script doesn't work right in the context you are having trouble then the fault is not with Perl but with the context.

      Update: Note that PerlMonks has munted the unicode characters :-(. The original script used Unicode characters for the string, not entities. The following also works and uses HTML entities in place of the unicode characters:

      use strict; use warnings; use utf8; use HTML::Entities; my $str = 'עוד להיט'; binmode STDOUT, ":encoding(utf8)"; print HTML::Entities::decode ($str);
      True laziness is hard work
        good idea thx.
        Tried both over my extracted text but none returned it to it's normal form.
        also tried decode_entities but still didn't help.
        also tried without the use utf8; and the binmode STDOUT, ":encoding(utf8)";
        but still same problem remains.
      You forgot binmode STDOUT, ":encoding(utf8)";
      umm.. that was the script.

      But you're still not showing how you're invoking pp

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://904761]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-03-28 16:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found