Friday, March 25, 2016

UnicodeEncodeError: 'charmap' codec can't encode character u'\u0218' in position 0: character maps to

Hi,

I have a Django application where I have to update some personal data in a Firebird 2.5 DB with cp1250 encoding.
Yesterday I got some Internal Server Error while updating a person's first or last name when using Ș, ș, Ț, ț characters.

The error can be easily reproduced in python (2.7 and 3.4) shell:
>>> u'Ș'.encode('cp1250')
UnicodeEncodeError: 'charmap' codec can't encode character u'\u0218' in position 0: character maps to <undefined>

How I can encode the mentioned characters in cp1250 to avoid this error? I must use the Firebird 2.5 with cp1250 encoding, so db change is not an option.

Thanks,
Zoltan

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a6992c71-31e7-4971-9026-bc5307456447%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment