in reply to How do I convert a string to Unicode and back (v5.005_03)?
I should warn you that while this code may work for ascii, it most definitely will not work for other character sets and/or encodings.
You can use the Unicode::Map module like this:
There is also to16() if you need utf16.perl -MUnicode::Map -e'print Unicode::Map->new(shift)->to8(<>)'
Note that not all mappings are round-trip, i.e. you won't necessarily get back what you put in if you try to "undo" the conversion.
For lots and lots of information on dealing with complex character set and encoding issues, see Ken Lunde's excellent book CJKV Information Processing from O'Reilly.
Or to skip the reading, you can just go to the examples and look at the perl directory.
|
---|
In Section
Seekers of Perl Wisdom