Comparing UTF-8 into USC-2 and vice versa (newbie :-) )

Tzury Afro.Systems at gmail.com
Sun Jun 17 03:07:38 EDT 2007


I recently rewrote a .net application in python.
The application is basically gets streams via TCP socket and handle
operations against an existing database.
The Database is SQLite3 (Encoded as UTF-8).
The Networks streams are encoded as UCS-2.

Since in UCS-2, 'A' = '0041' and when I check  with the built-in
functions I get for  unicode("A", "utf-8") = u'A' = u'\u0041'. I
wonder what is the difference, and how can I safely encode/decode
UCS-2 streams and match them with the UTF-8 representation




More information about the Python-list mailing list