Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Conversion between code page and unicode in Perl

by ikegami (Patriarch)
on Feb 10, 2012 at 09:26 UTC ( #952958=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://952958]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2022-07-06 04:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?