MySQLdb
Skip Montanaro
skip at pobox.com
Thu Jan 15 10:08:12 EST 2004
More information about the Python-list mailing list
Thu Jan 15 10:08:12 EST 2004
- Previous message (by thread): PyCon Reminders (proposal submission ends tonight!)
- Next message (by thread): MySQLdb
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Lukas> I want add the new record to Mysql database. When I use my script
Lukas> I got an exception "UnicodeEncodeError: 'ascii' codec can't
Lukas> encode character u'\xe4' in position 12: ordinal not in
Lukas> range(128).
Lukas,
You will need to encode your Unicode objects before stuffing the resulting
strings into MySQL. For example:
utf8foo = foo.encode("utf-8")
c.execute("insert into blah blah blah", (..., utf8foo, ...))
instead of
c.execute("insert into blah blah blah", (..., foo, ...))
Skip
- Previous message (by thread): PyCon Reminders (proposal submission ends tonight!)
- Next message (by thread): MySQLdb
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list