Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Python unicode utf-8 characters and MySQL unicode utf-8 characters

Reply
Thread Tools

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

 
 
Grzegorz liwiski
Guest
Posts: n/a
 
      01-18-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?
 
Reply With Quote
 
 
 
 
Kushal Kumaran
Guest
Posts: n/a
 
      01-18-2011
2011/1/18 Grzegorz Śliwiński <>:
> 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
 
Reply With Quote
 
 
 
 
Grzegorz liwiski
Guest
Posts: n/a
 
      01-19-2011
On 18 Sty, 18:15, Kushal Kumaran <kushal.kumaran+pyt...@gmail.com>
wrote:
> 2011/1/18 Grzegorz Śliwiński <sliwin...@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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Python and Connecting to MySQL remotely WITHOUT MySQL installedon local computer dave Python 4 11-18-2010 04:19 AM
Strange unicode / no unicode phenomen with mysql Hans Mller Python 1 12-03-2009 10:06 PM
how to store and still search special characters in Python and MySql ronrsr Python 1 02-15-2007 08:39 AM
Special Characters (Unicode, Ascii) in Python and MySQL ronrsr Python 1 01-02-2007 01:43 PM
Unicode + jsp + mysql + tomcat = unicode still not displaying Robert Mark Bram Java 0 09-28-2003 05:37 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57