从csv导入mysql时保留特殊字符 [英] Keep special characters when importing into mysql from csv

查看:41
本文介绍了从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时保留特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆