if (defined $string) { utf8::upgrade($string); Encode::_utf8_on($string); Encode::_utf8_off($string) if (!utf8::valid($string)); }