peterp has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
edit: apologies but the utf8 characters are not displaying properly in code. Each string is ϗblah頁.
I am having an issue in understanding what is happening between the two code snippets below. The first example generates a wide character error as expected since I haven't set STDOUT's encoding to utf8. However, in the second example, although I have pointed STDERR at STDOUT, no such error is generated on warn and it successfully prints out the utf8 characters. What exactly is happening here?
example 1
use strict; use warnings FATAL => qw#all#; use utf8; #print qq#content-type: text/plain; charset=UTF-8\n\n#; print q#print: ϗblah頁#; # wide char error.
example 2
use strict; use warnings FATAL => qw#all#; use utf8; *STDERR = *STDOUT; #print qq#content-type: text/plain; charset=UTF-8\n\n#; warn q#warn: ϗblah頁#; # no error. print q#print: ϗblah頁#; # wide char error still.
Thanks,
Peter
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unexpectedly no wide char error when stderr points at stdout
by hippo (Archbishop) on Feb 14, 2015 at 10:16 UTC | |
by peterp (Sexton) on Feb 14, 2015 at 14:08 UTC | |
|
Re: Unexpectedly no wide char error when stderr points at stdout
by choroba (Cardinal) on Feb 14, 2015 at 00:53 UTC | |
by peterp (Sexton) on Feb 14, 2015 at 01:01 UTC |