$str = "\xE2\x80\x9c"; use Encode; $d = decode_utf8($str); print "ok\n" if length($d)== 1 && $d eq "\x{201c}";