Loading ...
Sorry, an error occurred while loading the content.

RE: [PBML] Unicode Output Problem

Expand Messages
  • Mike Frank
    This is what I tried. use strict; use warnings; #use utf8; use Encode; my $Tomorrow = ma x{c3b1}ana ; my $temp_Tomorrow=decode_utf8($Tomorrow); print n
    Message 1 of 6 , Nov 15, 2010
    • 0 Attachment
      This is what I tried.



      use strict;
      use warnings;
      #use utf8;
      use Encode;

      my $Tomorrow = "ma\x{c3b1}ana";
      my $temp_Tomorrow=decode_utf8($Tomorrow);
      print "\n $temp_Tomorrow";

      #print $Tomorrow;



      How can I find out if STDOUT understands Unicode?
      Also, does Perl require a package for it to understand Unicode?

      Thanks

      -----Original Message-----
      From: Randal L. Schwartz [mailto:merlyn@...]
      Sent: Monday, November 15, 2010 10:47 AM
      To: Mike Frank
      Cc: perl-beginner@yahoogroups.com
      Subject: Re: [PBML] Unicode Output Problem

      >>>>> "Mike" == Mike Frank <m-frank@...> writes:

      Mike> I did do some reading in "perldoc perluniintro" and I never got an
      Mike> answer to my question about printing the actual Unicode character
      Mike> from the Unicode. The only thing I was able to accomplish was the
      Mike> elimination of "wide character"; it did not print the character
      Mike> (which is what I wanted it to do).

      Show what you tried. How did you change the code you just posted?

      And keep in mind, the path from the stdout to your terminal must also
      understand unicode.

      That's the problem with unicode... lots of moving parts.

      --
      Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
      <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
      Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
      See http://methodsandmessages.posterous.com/ for Smalltalk discussion
    • merlyn@stonehenge.com
      ... Mike This is what I tried. Mike use strict; Mike use warnings; Mike #use utf8; Mike use Encode; Mike my $Tomorrow = ma x{c3b1}ana ; Mike my
      Message 2 of 6 , Nov 15, 2010
      • 0 Attachment
        >>>>> "Mike" == Mike Frank <m-frank@...> writes:

        Mike> This is what I tried.
        Mike> use strict;
        Mike> use warnings;
        Mike> #use utf8;
        Mike> use Encode;

        Mike> my $Tomorrow = "ma\x{c3b1}ana";
        Mike> my $temp_Tomorrow=decode_utf8($Tomorrow);
        Mike> print "\n $temp_Tomorrow";

        Mike> #print $Tomorrow;



        Mike> How can I find out if STDOUT understands Unicode?
        Mike> Also, does Perl require a package for it to understand Unicode?

        You aren't telling Perl that stdout is unicode.

        Please read the rest of perluniintro, especially:

        To output UTF-8, use the ":encoding" or ":utf8" output layer.
        Prepending

        binmode(STDOUT, ":utf8");

        to this sample program ensures that the output is completely UTF-8, and
        removes the program's warning.

        And then eliminate your decode_utf8 call.

        --
        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
        <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
        Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
        See http://methodsandmessages.posterous.com/ for Smalltalk discussion
      Your message has been successfully submitted and would be delivered to recipients shortly.