Thank you for this tip, I will use that to get better error messages. But yet it does not give me the string in UTF-8 and it shows the error again:
The code is just as yours, with this in the end:
print decode utf8 => $q->param('key');
The "decode utf8" is not needed in my opinion, as the input is already UTF-8, and same error "wide character" is shown on above.
But without "decode utf8 =>" I get no errors, but I get this characters: �� -- occurrence is strange, as the script just worked fine with Unicode.