in reply to Re^3: UTF-8 and Unicode the hard way
in thread UTF-8 and Unicode the hard way

produces a "wide character in output" error.

hmm, are you saying your string is a garbage mix of UTF-8 and Unicode Code Points? Please provide the output of

use Data::Dumper; local $Data::Dumper::Useqq = 1; print(Dumper($s));

$answer = encode("UCS-2BE", $answer); results in \u0000 in front of EVERY character in output

encode does not add the 6-charater string \u0000, but it should indeed add a zero byte in front of ASCII characters (and more).


[Sorry, this was meant to be a reply to the OP, not Corion]