[Django]-Getting error when INSERT into MySQL

3👍

You basically need to ensure proper a string encoding. E.g. the string you provide to django is not UTF-8 encoded and therefore some characters can’t be resolved.

Some helpful advice on how to find the encoding of the requested page can be found here: urllib2 read to Unicode

👤miku

0👍

There are 2 ways to go if you want to alter the character set in MySQL.
First is the default of the database, see MySQL Alter database,
and the second is per-table: MySQL Alter Table.

The database gives the default charset for, I believe, new tables. This
can be overridden on a per-table basis, which you need to do since you
already have tables. “utf8” is a supported character set.

Also have a look at Blog about UTF8 with django and MySQL.

Leave a comment