http://www.perlmonks.org?node_id=1069406


in reply to How to tell if a stream is already in UTF8 mode?

Your design is awful, but you can use PerlIO::get_layers($fh) to look for the utf8 layer.