从csv导入mysql时保留特殊字符

Keep special characters when importing into mysql from csv(从csv导入mysql时保留特殊字符)
本文介绍了从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时保留特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)