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

2021-12-25 00:00:00 csv import 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

相关文章