Maxim Kasimov wrote: > Christos TZOTZIOY Georgiou wrote: > > > > If unicode_data references your unicode data, all you have to send is: > > > > unicode_data.encode('utf-16') # maybe utf-16be for network order > > > is utf-16 string the same ucs-2? my question is how to get string > encoded as UCS-2
utf-16 is basically a superset of ucs-2. See here for more detail: http://www.azillionmonkeys.com/qed/unicode.html If you ensure that ord() of each output character is < 0x10000 you'll get valid ucs-2 output if you use utf-16 encoding. If you build python with --enable-unicode=ucs2 no character can be >= 0x10000 so you don't have to check. On the other 1) you won't be able even to input characters >= 0x10000 into your application and 2) premature optimization is bad and 3) There is a note in README: To compile Python2.3 with Tkinter, you will need to pass --enable-unicode=ucs4 flag to ./configure Serge. -- http://mail.python.org/mailman/listinfo/python-list