See this
In reply to Re: Perl detect utf8, iso-8859-1 encoding by ikegami in thread Perl detect utf8, iso-8859-1 encoding by swiftlet