[Tutor] Convert CJK text into HEX value string

Kojo Idrissa kojo@hal-pc.org
Sun, 14 Jul 2002 23:15:06 -0500


If this was ASCII text, the atoi() function [which I just saw has been 
depricated] from the string module would do the trick.  Convert the text to 
an integer, then into hex.

I think the CJK characters are represented as Unicode (as opposed to 
ASCII).  If that's the case, the Unicode module is able to convert those 
strings in a manner similar to the String module.  Check out the decimal(), 
digit() and numeric() functions.  I don't have any CJK data to test this 
with, or I'd try for you and see.  Here's the link to the Unicode module docs:
<http://www.python.org/doc/current/lib/module-unicodedata.html>

If I'm way off base with this, someone jump in and correct me.

I might have to test this out myself.  I just started a new job a view 
weeks ago and a lot of our clientele is in Asia.  Japan especially.  I 
might want to do some text manipulation.

At 02:30 AM 7/15/2002 +0000, Hy wrote:
>Does anyone know how to Convert CJK(Chinese/Japanese/Korean) text into HEX 
>value string?
>I need to pass CJK Text via POST/GET cgi method. I need to convert the 
>text into a string of HEX values like "%BE%DF".
>
>Thanks a lot for your help.
>
>Hy

****************************
Kojo Idrissa

kojo@hal-pc.org
http://www.hal-pc.org/~kojo/
****************************