Unicodeencodeerror: ' latin-1 ' codec can ' t encode character
"Unicodeencodeerror: ' latin-1 ' codec can ' t encode character ..."
This was because mysqldb normally tries to encode Everythin to latin-1. This can is fixed by executing the following commands right after you ' ve etablished the connection:
Db.set_character_set ('utf8') dbc.execute ('set NAMES UTF8; ') Dbc.execute ('set CHARACTER set UTF8; ' ) Dbc.execute ('SET Character_set_connection=utf8; ')
The "DB" is the result of MySQLdb.connect, and "DBC" is the result of the Db.cursor ().
This means that mysqldb will normally try to convert everything to latin1 character set processing so the way to do this is to set the charset of the connection and the cursor to the encoding you want, such as UTF8
DB is a connection connection, DBC is a database cursor
Http://stackoverflow.com/questions/3942888/unicodeencodeerror-latin-1-codec-cant-encode-character
"Go" python mysql database ' latin-1 ' codec can ' t encode character error problem resolution