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

vincent wehren v.wehren at home.nl
Wed Feb 12 13:17:27 EST 2003


"Thomas Guettler" <zopestoller at thomas-guettler.de> schrieb im Newsbeitrag
news:b2dibi$sqq$00$1 at news.t-online.com...
> 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?

"\xb3" SUPERSCRIPT THREE, is not available in Windows Codepage 1251, so you
either have to
not encode to cp1251 and stick with unicode, or find a suitable replacement
character...

HTH
Vincent Wehren

>
> 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