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时保留特殊字符


基础教程推荐
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01