Malformed UTF-8 character: \xe9\x27\x20 (unexpected non-continuation byte 0x27,immediately after start byte 0xe9; need 3 bytes, got 1) at try.pl line 11. Malformed UTF-8 character (fatal) at try.pl line 11. #### #!/usr/bin/perl use strict; use warnings; use utf8; use Devel::Peek; use Data::Dumper; $Data::Dumper::Useqq = 1; my $s; { no utf8; $s = 'clé'; } utf8::upgrade($s); my %hash = ( $s => 0, ); my $key = (keys %hash)[0]; Dump($key); print Dumper($key); $hash{$s} = 1; $key = (keys %hash)[0]; Dump($key); print Dumper($key); utf8::upgrade($key); # does nothing Dump($key); print Dumper($key); #### SV = PV(0x84c2a8) at 0x373100 REFCNT = 1 FLAGS = (POK,pPOK,UTF8) PV = 0x247ede8 "cl\303\251"\0 [UTF8 "cl\x{e9}"] CUR = 4 LEN = 5 $VAR1 = "cl\x{e9}"; SV = PV(0x84c2a8) at 0x373100 REFCNT = 1 FLAGS = (POK,pPOK,UTF8) PV = 0x247f4d8 "cl\303\251"\0 [UTF8 "cl\x{e9}"] CUR = 4 LEN = 5 $VAR1 = "cl\x{e9}"; SV = PV(0x84c2a8) at 0x373100 REFCNT = 1 FLAGS = (POK,pPOK,UTF8) PV = 0x247f4d8 "cl\303\251"\0 [UTF8 "cl\x{e9}"] CUR = 4 LEN = 5 $VAR1 = "cl\x{e9}";