MySQL 警告:不正确的字符串值:'\x96

MySQL warning: Incorrect string value: #39;\x96(MySQL 警告:不正确的字符串值:\x96)
本文介绍了MySQL 警告:不正确的字符串值:'\x96的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在尝试导入一个 CVS 文件,并在其中收到此警告:1366 不正确的字符串值:'\x96 PART ...' 列

I'm trying to import a CVS file where I get this warning: 1366 Incorrect string value: '\x96 PART...' for column

我在某处读到这是关于 4 位 utf8 字符的.但是将表和列的排序规则更改为 utf8mb4 也不起作用.

I read somewhere that this is about the 4-bit utf8 characters. But changing the collation of the table and column into utf8mb4 didn't work either.

推荐答案

十六进制 96 大概是 en-dashlatin1 编码> ().但是你已经指定了 CSV 文件是 utf8 编码的(或者 utf8mb4),这个字符是 utf8 无法理解的.

The hex 96 is presumably the latin1 encoding for an en-dash (). But you have specified that the CSV file is utf8-encoded (or utf8mb4), this character is incomprehensible to utf8.

计划 A:更改文件.(这可能不切实际.)

Plan A: Change the file. (This is probably not practical.)

计划 B:告诉 MySQL 该文件是 latin1(而不是 utf8).然后 MySQL 会将其正确转换为 utf8 编码 E28093.

Plan B: Tell MySQL that the file is latin1 (as opposed to utf8). Then MySQL will convert it correctly to the utf8-encoding E28093.

整理"与排序和比较有关;字符集"与编码"有关.

"Collation" has to do with sorting and comparing; "Character set" has to do with 'encoding'.

将此添加到我假设您正在使用的 LOAD DATA 语句中:

Add this to the LOAD DATA statement that I assume you are using:

CHARACTER SET latin1

参考.

这篇关于MySQL 警告:不正确的字符串值:'\x96的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)