in reply to detect incorrect character encoding
{ local $SIG{__WARN__} = sub { die "$filename is invalid utf8!\n" }; eval { .. }; } [download]