如下:
复制代码 代码如下:
Warning at /admin/assets/add/
Incorrect string value: '\xE5\x93\x88\xD5\x92\x88...' for column 'Name' at row 1
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/assets/add/
Django Version: 1.2.3
Exception Type: Warning
Exception Value:
Incorrect string value: '\xE5\x93\x88\xD5\x92\x88...' for column 'Name' at row 1
Exception Location: /usr/lib/pymodules/python2.7.1/MySQLdb/cursors.py in _warning_check, line 82
Python Executable: /usr/bin/python
Python Version: 2.7.1
初步判断 应该是mysql的问题 [代研究本质问题]:
在my.ini 添加如下:
复制代码 代码如下:
[client]
character-set-client = utf8
default-character-set = utf8
[mysqld]
character-set-server = utf8
character-set-filesystem = utf8[mysql]
init_connect='SET NAMES utf8'
[mysql]
default-character-set=utf8
重启mysql服务器,问题解决。
查看创建mysql数据库的默认编码:
show create database db_name;
更改已经创建的db的编码:
alter database db_name character set utf8 collate utf8_general_ci;
查看数据库相关信息:
mysql>status
查看数据库相关信息2:
mysql> show variables like 'char%