how to convert from unicode to another codepage

Thomas Guettler pan-newsreader at thomas-guettler.de
Mon Apr 7 09:10:02 EDT 2003


On Mon, 07 Apr 2003 14:16:26 +0200, Ruslan Spivak wrote:

> Hello, python users!
> 
> I need to convert string from utf-8 in 'cp1251' codepage. How to achieve
> that?

cyrillic_utf8='....'
u=unicode(cyrillic, 'utf8')
cyrillic_cp1251=u.encode('cp1251')

 thomas


-- 
Thomas Guettler <guettli at thomas-guettler.de>
http://www.thomas-guettler.de




More information about the Python-list mailing list