use strict; use warnings; use Test::More; plan tests => 43; use HTTP::Response; my $r = HTTP::Response->new(200, "OK"); is($r->content_charset, undef); is($r->content_type_charset, undef); $r->content_type("text/plain"); is($r->content_charset, undef); $r->content("abc"); is($r->content_charset, "US-ASCII"); $r->content("f\xE5rep\xF8lse\n"); is($r->content_charset, "ISO-8859-1"); $r->content("f\xC3\xA5rep\xC3\xB8lse\n"); is($r->content_charset, "UTF-8"); $r->content_type("text/html"); $r->content(<<'EOT'); EOT is($r->content_charset, "UTF-8"); $r->content(<<'EOT'); EOT is($r->content_charset, "UTF-8"); $r->content(<<'EOT');