MySQL Insert Unicode Problem

erikcw erikwickstrom at gmail.com
Mon Apr 9 19:11:56 CEST 2007


Hi,

I'm trying to insert some data from an XML file into MySQL.  However,
while importing one of the files, I got this error:

Traceback (most recent call last):
  File "wa.py", line 304, in ?
    main()
  File "wa.py", line 257, in main
    curHandler.walkData()
  File "wa.py", line 112, in walkData
    self.cursor.execute(*sql) #try multi-execute to speed up query.
  File "build/bdist.linux-i686/egg/MySQLdb/cursors.py", line 151, in
execute
  File "build/bdist.linux-i686/egg/MySQLdb/connections.py", line 247,
in literal
  File "build/bdist.linux-i686/egg/MySQLdb/connections.py", line 185,
in unicode_literal
UnicodeEncodeError: 'latin-1' codec can't encode character u'\u20ac'
in position 28: ordinal not in range(256)

What do I need to change to make this work?

Thanks!
Erik




More information about the Python-list mailing list