Thank you, Michal
On Fri, Mar 25, 2016 at 11:47 AM, Michal Petrucha <michal.petrucha@koniiiik.org> wrote:
On Fri, Mar 25, 2016 at 02:12:27AM -0700, Zoltán Bege wrote:
> 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.
The four characters you listed above do not have a representation in
CP-1250. However, CP-1250 does have similar characters: "Ş", "ş", "Ţ",
and "ţ". They look similar, but they are not the same – yours are
letters with a comma underneath, and the ones supported by CP-1250
have a cedilla.
What you could do is use str.translate, or just four str.replace calls
to replace those wrong characters with ones supported in CP-1250.
Good luck,
Michal
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/5PusaQjQfWA/unsubscribe.
To unsubscribe from this group and all its topics, 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/20160325094719.GD25061%40koniiiik.org.
For more options, visit https://groups.google.com/d/optout.
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/CAMFaZY5J6uaF_naQ-vfEq_ZoLURdy3ZhoZ3w6rmx9Ce%2BPQhE1w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment