Wednesday, August 21, 2013

Can't decode french characters after switching to PostgrSQL from MySQL

my code worked fine up until I switched to PostgreSQL from MySQL. Now I am bombarded with these errors whenever I have french accents in my strings. My database is correctly configured with LATIN1 (as UTF8 didn't like the accents when trying to import them from MySQL, the default was UTF8).

My postgresql.conf has the right settings by the look of it:
client_encoding = latin1                # encoding

# These settings are initialized by initdb, but they can be changed.
lc_messages = 'en_CA.iso88591'                  # locale for system error message
                                        # strings
lc_monetary = 'en_CA.iso88591' #en_US.UTF-8'    # locale for monetary formatting
lc_numeric = 'en_CA.iso88591'                   # locale for number formatting
lc_time = 'en_CA.iso88591' 

How do I switch this ascii decoder in django to a decoder that can handle french accents?

UnicodeDecodeError at /alarms/edit/100/

'ascii' codec can't decode byte 0xc3 in position 10: ordinal not in range(128)
Request Method:POST
Request URL:https://mandala.cldssinc.com/alarms/edit/100/
Django Version:1.5.2
Exception Type:UnicodeDecodeError
Exception Value:
'ascii' codec can't decode byte 0xc3 in position 10: ordinal not in range(128)
Exception Location:/var/web/mandala_env/mandala/alarms/models.py in __unicode__, line 21
Python Executable:/var/web/mandala_env/bin/python
Python Version:2.6.6
Python Path:
['/var/web/mandala_env/mandala/mandala',   '/var/web/mandala_env/mandala',   '/var/web/mandala_env/bin',   '/var/web/mandala_env/lib64/python26.zip',   '/var/web/mandala_env/lib64/python2.6',   '/var/web/mandala_env/lib64/python2.6/plat-linux2',   '/var/web/mandala_env/lib64/python2.6/lib-tk',   '/var/web/mandala_env/lib64/python2.6/lib-old',   '/var/web/mandala_env/lib64/python2.6/lib-dynload',   '/usr/lib64/python2.6',   '/usr/lib/python2.6',   '/var/web/mandala_env/lib/python2.6/site-packages']
Server time:
Thu, 22 Aug 2013 01:16:16 -0400






Thanks

--
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate