Keep special characters when importing into mysql from csv(从csv导入mysql时保留特殊字符)
问题描述
我有一个包含特殊字符的 csv 文件.但是,当我将它们导入我的表时,它们不会导入.我有需要包含特殊字符的行设置为 utf8_general_ci
I have a csv file which contains special characters. However, when I import them into my table they do not import. I have the row that needs to contain special characters setup as utf8_general_ci
但是,我在 phpmyadmin 导入时丢失了特殊字符.例如,未导入度数符号.我在文本编辑器中查看了我的 csv 文件,它确实包含特殊字符.
However, I am losing the special characters upon phpmyadmin import. For example, the degree symbol is not importing. I viewed my csv file in a text editor and it does contain the special characters.
请帮忙.
好的,我想出了如何做到这一点.请看我下面的回答.
Ok, I figured how to do this. See my answer below.
推荐答案
在尝试上传文件时只需要更改 mysql 中的字符集.在我的情况下,字符集 windows-1252
Only needs change the charset in mysql when try to upload the file. In my case works the charset windows-1252
这篇关于从csv导入mysql时保留特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从csv导入mysql时保留特殊字符
基础教程推荐
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 在多列上分布任意行 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
