On Dec 20, 2004, at 6:19 PM, Michael G Schwern wrote:
Is there a module or function in Perl that can provide this information?
Why does it matter what it was set to before? I'm always going to be shoving text out through this filehandle.
It matters because if I'm using Big5 in my module, I *don't* want binmode set to ":utf8", which is Perl's internal representation of UTF-8. I would want it set to ":big5".
Again, this is not something the user should have to care about.
Only text is shoved through those filehandles so setting them to handle Unicode should always be the right thing to do, unless it breaks an old perl.
Well, if that's the case, then the smarter thing might be to encode utf8 strings in Test::Builder before outputting them. You'd have to do something like this:
print $fh map { $_ = Encode::encode_utf8($_) if Encode::is_utf8($_); $_ } @_;
This should prevent the warning from happening.
Regards,
David