|Just another Perl shrine|
get UTF-8 character codesby Skeeve (Vicar)
|on Oct 31, 2005 at 15:34 UTC||Need Help??|
Skeeve has asked for the
wisdom of the Perl Monks concerning the following question:
Dear fellow monks!
I'm a bit lost with utf-8 conversion. For a FictionBook 2 eReader conversion script, I need to have "translations" for some UTF-8 characters to the appropriate eReader characters.
For this I used a part of the table found at eReader.com and stored it as a UTF8 file:
Next I wanted to prepend the first character with it's UTF-8 unicode 4 digit code by using a oneliner (splitted here for better readability):
Unfortunately I seem to miss something. I get data like this:
3 time 00c2 can't be true.
Do you see my mistake?
Update: Experimenting and reading perldoc perlrun, especially about -C led me to this version, which seems to work quite well:
Update2: No... It still doesn't work