Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
After construction of the table MySql Chinese inserted into the data given in the table, 1366 - Incorrect string value: ' \ xE9 \ x97 \ xAE' for column 'jobName' at row 1
Time: 0.038s
create table Tab_jobInfo
(
jobID int not null auto_increment,
jobName varchar(50),
companyName varchar(50),
adress varchar(50),
salary varchar(50),
time varchar(50),
primary key (jobID)
);
insert into Tab_jobInfo(jobID,jobName,companyName,adress,salary,time) values(1, 'C++工程师', '深圳市风云实业有限公司', '成都-青羊区', '0.8-1.4万/月', '06-29')
运行后报如下错误:
insert into Tab_jobInfo(jobID,jobName,companyName,adress,salary,time) values(1, '问', '深圳市风云实业有限公司', '成都-青羊区', '0.8-1.4万/月', '06-29')
1366 - Incorrect string value: '\xE9\x97\xAE' for column 'jobName' at row 1
时间: 0.038s
The reason is to specify the encoding format when construction of the table, at the end of construction of the table statement specifies the character encoding plus code can be solved. code show as below:
create table Tab_jobInfo
(
jobID int not null auto_increment,
jobName varchar(50),
companyName varchar(50),
adress varchar(50),
salary varchar(50),
time varchar(50),
primary key (jobID)
)DEFAULT CHARSET=utf8; #指定默认编码格式
insert into Tab_jobInfo(jobID,jobName,companyName,adress,salary,time) values(1, 'C++工程师', '深圳市风云实业有限公司', '成都-青羊区', '0.8-1.4万/月', '06-29')
运行结果:
insert into Tab_jobInfo(jobID,jobName,companyName,adress,salary,time) values(1, 'C++工程师', '深圳市风云实业有限公司', '成都-青羊区', '0.8-1.4万/月', '06-29')
Affected rows: 1
时间: 0.298s