Re: Can't decode french characters after switching to PostgrSQL from MySQL
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.
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