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

查看:822
本文介绍了从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.

推荐答案

好的,

保留导出的csv文件在utf8中,同时保留特殊字符执行以下操作。

for anyone who has this same issue trying to keep the exported csv file in utf8 while keeping the special characters do the following.

在OpenOffice Calc中打开文件。当你准备好保存它保存为文本csv文件。当导出它会问你什么格式保存为。保存为UTF8和presto。它不会转换你的特殊字符,如excel。

Open up your file in OpenOffice Calc. When you get ready to save it save it as text csv file. While exporting it will ask you what format to save it as. Save it as UTF8 and presto. It does not convert your special characters like excel does.

希望能帮助别人。

这篇关于从csv导入到mysql时保留特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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