http://qs321.pair.com?node_id=952958


in reply to Conversion between code page and unicode in Perl

If you want Unicode code points (replace 1252 with the code page in question),

my $code_points = decode('cp1252', $cp1252_bytes);

If you want UTF-16le, the encoding Windows calls "Unicode", continue with

my $utf16le_bytes = encode('UTF-16le', $code_points);

decode and encode are provided by Encode. It's from_to can combine decode+encode.

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.