Some of the fields in my application's database contain unicode
strings.  I serialized this database into a fixture.  When I try to
load that fixture into a machine running MySQL I get an warning from
MySQLdb/cursors.py about an "Incorrect string value" and my database
is left incomplete.  The same thing happens if I serialize to .xml
or .json

Googling around it looks like there are issues with configuring
MySQLdb to properly handle unicode, but I couldn't find a clear
workaround.  Does anyone know how I can import a database from a table
containing unicode?

Thanks.

Here is the full error:

$ python2.6 manage.py syncdb
/opt/python-2.6/lib/python2.6/site-packages/MySQL_python-1.2.2-py2.6-
linux-x86_64.egg/MySQLdb/__init__.py:34: DeprecationWarning: the sets
module is deprecated
Installing json fixture 'initial_data' from '/projects/lingshare/web-
interface/lingshare/../lingshare/phonemechart/fixtures'.
Problem installing fixture '/projects/lingshare/web-interface/
lingshare/../lingshare/phonemechart/fixtures/initial_data.json':
Traceback (most recent call last):
  File "/opt/python-2.6/lib/python2.6/site-packages/django/core/
management/commands/loaddata.py", line 153, in handle
    obj.save()
  File "/opt/python-2.6/lib/python2.6/site-packages/django/core/
serializers/base.py", line 163, in save
    models.Model.save_base(self.object, raw=True)
  File "/opt/python-2.6/lib/python2.6/site-packages/django/db/models/
base.py", line 474, in save_base
    rows = manager.filter(pk=pk_val)._update(values)
  File "/opt/python-2.6/lib/python2.6/site-packages/django/db/models/
query.py", line 444, in _update
    return query.execute_sql(None)
  File "/opt/python-2.6/lib/python2.6/site-packages/django/db/models/
sql/subqueries.py", line 120, in execute_sql
    cursor = super(UpdateQuery, self).execute_sql(result_type)
  File "/opt/python-2.6/lib/python2.6/site-packages/django/db/models/
sql/query.py", line 2369, in execute_sql
    cursor.execute(sql, params)
  File "/opt/python-2.6/lib/python2.6/site-packages/django/db/backends/
util.py", line 19, in execute
    return self.cursor.execute(sql, params)
  File "/opt/python-2.6/lib/python2.6/site-packages/django/db/backends/
mysql/base.py", line 84, in execute
    return self.cursor.execute(query, args)
  File "build/bdist.linux-x86_64/egg/MySQLdb/cursors.py", line 168, in
execute
    if not self._defer_warnings: self._warning_check()
  File "build/bdist.linux-x86_64/egg/MySQLdb/cursors.py", line 82, in
_warning_check
    warn(w[-1], self.Warning, 3)
Warning: Incorrect string value: '\xC9\x92' for column 'ipa' at row 1

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to