FAQ
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?

Search Discussions

  • Kushal Kumaran at Jan 18, 2011 at 5:15 pm

    2011/1/18 Grzegorz ?liwi?ski <sliwinski at red-sky.pl>:
    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?
    Did you pass the charset argument when creating your MySQLdb connection?

    --
    regards,
    kushal
  • Grzegorz ¦liwiński at Jan 19, 2011 at 7:31 am

    On 18 Sty, 18:15, Kushal Kumaran wrote:
    2011/1/18 Grzegorz ?liwi?ski <sliwin... at red-sky.pl>:
    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?
    Did you pass the charset argument when creating your MySQLdb connection?

    --
    regards,
    kushal
    Hello, yes, although I usually just use SET NAMES utf8; after
    encountering the problem first, I tried the charset option as well,
    but there's no difference.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedJan 18, '11 at 10:22a
activeJan 19, '11 at 7:31a
posts3
users2
websitepython.org

People

Translate

site design / logo © 2022 Grokbase