# https://rt.cpan.org/Public/Bug/Display.html?id=52572 use strict; use warnings; use Test::More; plan tests => 2; use Encode qw( encode ); use HTTP::Headers qw( ); use HTTP::Response qw( ); use PerlIO::encoding qw( ); { my $builder = Test::More->builder; local $PerlIO::encoding::fallback = Encode::PERLQQ(); binmode $builder->output, ":encoding(US-ASCII)"; binmode $builder->failure_output, ":encoding(US-ASCII)"; binmode $builder->todo_output, ":encoding(US-ASCII)"; } for my $enc (qw( UTF-8 UTF-16le )) { my $file = encode($enc, ($enc =~ /^UTF-/ ? "\x{FEFF}" : "") . qq{\n} . qq{\x{C9}ric\n} ); my $headers = HTTP::Headers->new(Content_Type => "application/xml"); my $response = HTTP::Response->new(200, "OK", $headers, $file); is($response->decoded_content, qq(\n\x{c9}ric\n), $enc); }