PerlIO の encoding layer は,$PerlIO::encoding::fallback という変数に fallback type を指定しておくことができるみたい。ということを PerlIO::encoding - encoding layer - metacpan.org 見て知った。encoding いじるのに PerlIO 使うのはなんとなく敬遠してたんだけど,fallback できるんなら使う価値あるんじゃね,と思って,POD にしたがってコードを書いてみた。 #!/usr/bin/perl use strict; use warnings; use Encode; use PerlIO::encoding; local $PerlIO::encoding::fallback = Encode::FB_XMLCREF() ; my $output = q{};