Solve the UTF8 problem #47

schwern opened this Issue Aug 28, 2010 · 5 comments


None yet

2 participants

schwern commented Aug 28, 2010

Test::Builder has a problem that when it clones filehandles it does not clone their layers. This means even if you make STDERR and STDOUT utf8 sensitive TB1 won't see that in its dup'd filehandles.

There was an attempt to clone the I/O layers, but it failed due to Perl bugs. This has to be fixed in TB2.

At minimum a method to quickly apply I/O layers to all the output handles.


This issue is also in Google Code with a temporary kludgy fix:

binmode Test::More->builder->output, ":utf8";
binmode Test::More->builder->failure_output, ":utf8";


Which commit represents Test::More 0.98? I'd like to branch off that commit and potentially fix this.


I've also found that using the -CS or PERL_UNICODE='' with Perl 5.14 fixes this too:

$ perl5.14 -CS t/test.t
$ env PERL_UNICODE='' perl5.14 t/test.t

schwern commented Aug 12, 2011

The v0.98 tag is what you're looking for. But new work would be better done off master. I'll just have to merge it anyway.

See 401fa01. Test::More 0.98 will inherit I/O layers from STDOUT and STDERR IF AND ONLY IF those layers are set before Test::More loads. That's probably why PERL_UNICODE works.

What's your plan?

schwern commented Nov 22, 2011

I think Test::Builder1.5 mitigates this problem well enough to close this.

Test::Builder1.5 delays copying STDOUT and STDERR until they're needed. That gives more space for the test author to set up encodings on them before testing starts.

The Test::More docs have been updated to explain how to deal with this problem.

The todo_output() handle is no longer relevant making it easier to set encodings on just two handles instead of three.

@schwern schwern closed this Nov 22, 2011
@schwernbot schwernbot referenced this issue in Test-More/TB2 Mar 16, 2014

Solve the UTF8 problem #95

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment