unicode.encode('windows-1251'): u'\xb3'

Thomas Guettler zopestoller at thomas-guettler.de
Wed Feb 12 08:35:48 EST 2003


Hi!

I am translating an application to the bulgarian language
with the help of python's unicode support.

I get an error if I try to encode the following line:

German:
u'mittlerer Dampfdruck (10...10\xb3 Pa)'

Bulgarian:
u'\u0441\u0440\u0435\u0434\u043d\u043e\u043f\u0430
\u0440\u043d\u043e\u043d\u0430\u043b\u044f\u0433
\u0430\u043d\u0435(10...10\xb3 Pa)'

The error appears when encoding this charachter:
u'\xb3'

I get the unicode strings from an xml file created
with MS-Excel.

Has someone a hint? Is this character missing in cp1251.py?

Error:
File "/tmp/python.3132/usr/lib/python2.2/encodings/cp1251.py", line 18, 
in encode
UnicodeError: charmap encoding error: character maps to <undefined>

Python Version:
Python 2.2.2 (#1, Nov 15 2002, 07:49:04)
[GCC 2.95.3-5 (cygwin special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.

  thomas





More information about the Python-list mailing list