encoding

Oleg Broytmann phd at phd.pp.ru
Mon Aug 27 12:32:21 EDT 2001


Hello!

   Welcome to the Russian-speaking Python and Zope User Group: zope.net.ru.
We have mailing list. Please subscribe: http://zope.net.ru/About/mail-list/

On Mon, 27 Aug 2001, Sergei N. Maslennikov wrote:
> How to convert a string from any national encoding to another? For
> example from cp866 to cp1251.

   print "Сергей".encode("cp1251")
   print unicode("Сергей").encode("cp1251")
   print unicode("Сергей", "koi8-r").encode("cp1251")
   print unicode("яЕПЦЕИ", "cp1251").encode("koi8-r")

Oleg.
----
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list