Subject: | UTF-8 to STDOUT broken? |
I think the following should show the problem. When PERL_UNICODE is set to AS (see -C in
perlrun), then STDIN, STDOUT and STDERR are all opened as utf8. Combine that with "use
utf8" in your code and, if everything is UTF-8, then Perl magically *works* with UTF-8
(cough).
Consider this file:
$ cat munchen.t
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
print "1..1\n";
print "ok 1 - München\n";
We manually print test results to make it clear that no Test:: module's output is broken.
Here's the default behavior:
$ perl munchen.t
1..1
ok 1 - M?nchen
Hmm, that's not good, so let's set the PERL_UNICODE variable.
$ PERL_UNICODE=AS perl munchen.t
1..1
ok 1 - München
OK, that's perfect. Now with "prove".
$ prove -v munchen.t
munchen.t ..
1..1
ok 1 - M?nchen
ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.03 usr + 0.01 sys = 0.04 CPU)
Result: PASS
That's not surprising, so let's set the PERL_UNICODE again.
$ PERL_UNICODE=AS prove -v munchen.t
munchen.t ..
1..1
ok 1 - München
ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.06 usr + 0.01 sys = 0.07 CPU)
Result: PASS
Oh, that's disappointing. I wish I had time to dig into this, but I don't. Sorry :/
Cheers,
Ovid