'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 |
Its not a problem with the conversion process. I re-created the schema using django syncdb and then I went table by table putting the data back in using csv files I exported from MySQL. I took the long way to get this all in and PostgreSQL had no problems taking my csv data as input. Any advice on how to get PostgreSQL running properly as MySQL did would be appreciated. It must be able to handle french accents which are not ascii.
Non-ASCII character '\xc3' in file /var/web/mandala_env/mandala/alarms/views.py on line 329, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details (views.py, line 329)
Is this normal? PostgreSQL is more strict with character types? So now I have to add # coding=<encoding name> to every py file in my django project?Also why did from django.contrib.auth.views.login become case sensitive? I have users that login with User and user, in PostgreSQL this is treated as 2 different things. Using MySQL it always saw it as one.. all very frustrating.
I will try SQLite tomorrow maybe instead, been up 2 days straight trying to get this to work and I really don't want to use MySQL anymore since its now owned by Oracle and slowly going to become closed source while MariaDB is not fully supported by Django just yet.
Its not a problem with the conversion process.
I re-created the schema using django syncdb and then I went table by table putting the data back in using csv files I exported from MySQL. I took the long way to get this all in and PostgreSQL had no problems taking my csv data as input. Any advice on how to get PostgreSQL running properly as MySQL did would be appreciated. It must be able to handle french accents which are not ascii.
From what I read, SQLite is production grade and its the most used database in the world.. besides the point.
Russ like I said before, I used COPY to get the data back in and it was accepted by postgres with the schema it crated using django (See step 5 below)
1) Export each table individually from MySQL into csv format.
2) Have Django re-create the models schema from django on its own.
3) Export the django schema using pg_dump for comparison
Repeat 5, 6 for each table: 4) Compare each csv file to the postgre schema for each table and align the data accordingly using spreadsheet software.
5) Use COPY (postgre utiity) to insert data from the csv fie to the database.
COPY locations_location FROM '/tmp/locations_location.csv' DELIMITER ',' CSV;
6) pg_dump dbname > outfile the data in order for migration. Restore on system using psql dbname < infile
When I was using COPY, it would complain about any issues and I fixed the csv's as I went along, so everything inserted was validated with PostgreSQL on the way in.
One very important question which I still don't understand. Are french characters such as "é" UTF-8 compatible or not? Because they seem to be sitting in the database just fine and they display just fine most of the time, but not when passing strings from my views, such as:
messages.success(request, u'{0} edited & saved Alarm Definition successfully.'.format(cur_alarm_rec))
I had to add the unicode u' around it because cur_alarm_rec contained an "é"
I also ended up adding the u to most of my models unicode output
def __unicode__(self):
return u'%s:%s' % (self.id, self.city)
As some cities contained special french accent characters as well.
ascii' codec can't decode byte 0xc3 in position 10: ordinal not in range(128) ?
Are french characters UTF-8 Compliant?
Would this insertion process not fail if the data contained within the postgres.sql file contain non UTF-8 characters when mandala4 in this case is UTF-8 encoded?
Are french characters UTF-8 Compliant?
| U+00E9 | é | c3 a9 | LATIN SMALL LETTER E WITH ACUTE |
--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
Convert sql file from latin to utf-8: