hello,
i have some text in french which i want to insert inside a mysql database, all is fine with the script, until the script reaches the html formatted text which has latin charecters.
here is the code:
http://paste.lisp.org/+22E5/2
when i print the code on the screen, i get the correct encoding, as http://paste.lisp.org/+22E5
but when the data is INSERT'ed into the DB all the encoding is broken!
how do i correctly insert the data with the right encoding into the table?
thanks
norman
i should have:
conn = MySQLdb.connect (host = "localhost",user = "user", passwd= "password",db = "test", use_unicode=True, charset="utf8")
this fixed it.
In the future (2.0), use_unicode and UTF8 will likely be the default.
Log in to post a comment.
hello,
i have some text in french which i want to insert inside a mysql database, all
is fine with the script, until the script reaches the html formatted text
which has latin charecters.
here is the code:
http://paste.lisp.org/+22E5/2
when i print the code on the screen, i get the correct encoding, as
http://paste.lisp.org/+22E5
but when the data is INSERT'ed into the DB all the encoding is broken!
how do i correctly insert the data with the right encoding into the table?
thanks
norman
i should have:
conn = MySQLdb.connect (host = "localhost",user = "user", passwd=
"password",db = "test", use_unicode=True, charset="utf8")
this fixed it.
In the future (2.0), use_unicode and UTF8 will likely be the default.