Menu

encoding issues

Help
2010-03-15
2012-09-19
  • norman khine

    norman khine - 2010-03-15

    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

     
  • norman khine

    norman khine - 2010-03-15

    i should have:

    conn = MySQLdb.connect (host = "localhost",user = "user", passwd=
    "password",db = "test", use_unicode=True, charset="utf8")

    this fixed it.

     
  • Andy Dustman

    Andy Dustman - 2010-03-16

    In the future (2.0), use_unicode and UTF8 will likely be the default.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.