On Wed, Nov 28, 2012 at 8:10 PM, boB Stepp <robertvst...@gmail.com> wrote:
> As I have mentioned in an earlier posting, I am working my way
> (slowly) through Learning Perl, 6th edition. In this edition it uses
> UTF-8 throughout. So I have been trying to make this happen in my
> Windows 7 Pro 64-bit environment.
>
> Currently the only way I have been able to display Unicode characters
> in the command console is as follows:
>
> #!/usr/bin/env perl -w
> use utf8;
>
> system "chcp 65001";
> print "\x{03B1}\x{03C9}\n";
>
> This seems to do the job, but is inelegant. I would much rather prefer
> that the command console automatically default to displaying all text
> as UTF-8, but Googling has not found a solution for me. Does anyone
> know how to solve this?
>
> One other thing that bugs me is that if I have warnings turned on as
> above and actually print non-ASCII characters, then I get an unwanted
> warning. For instance, the above code gives me this output:
>
> Active code page: 65001
> Wide character in print at helloworld.pl line 5.
> αω
>
> Press any key to continue . . .
>
> Ideally, I would rather I did not get the first two lines of output.
> Is there a way to accomplish this and still have warnings turned on?
> (I understand that the first line is a consequence of my system
> command to turn on UTF-8.)
>
>

binmode STDOUT, ":utf8";


-- 
Charles DeRykus

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to