Python unicode utf-8 characters and MySQL unicode utf-8 characters

Grzegorz Śliwiński sliwinski at red-sky.pl
Tue Jan 18 05:22:45 EST 2011


Hello,
Recently I tried to insert some unicode object in utf-8 encoding into
MySQL using MySQLdb, and got MySQL warnings on characters like:
𐎲𐎠𐎥𐎠 i found somewhere in my data. I can't even read them. MySQL
seems to cut the whole string after that characters off, so I get
incomplete data.
After a little bit of digging I found out, that MySQL usually supports
utf-8 data but encoded into maximum three bytes. That's why I think it
would help I f I was able to replace all larger unicode characters
with replacement characters.

Is there any way, I could adjust python unicode utf-8 encoded strings
to be accepted by mysql utf-8 columns?



More information about the Python-list mailing list