简体   繁体   English

MYSQL CSV导入字符变为“?”

[英]MYSQL CSV import Characters turn into '?'

I am new to MySQL and facing this trouble since many days ,please pardon my technical terminology. 我是MySQL的新手,而且已经经历了很多天的麻烦,请原谅我的技术术语。 After researching a lot and failing I decided to post the question. 经过大量研究和失败后,我决定发布问题。 I am using PHP and MYSQL to create customers web application. 我正在使用PHP和MYSQL创建客户Web应用程序。 The data from user comes in an excel file which goes into the application. 来自用户的数据进入一个excel文件,该文件进入应用程序。

The problem is this excel file has special characters all of them get converted to '?' 问题是此excel文件具有特殊字符,所有字符都转换为'?'。 when I import it into MYSQL using PHPMyAdmin GUI Import option. 当我使用PHPMyAdmin GUI导入选项将其导入MYSQL时。

What I have tried so far: 到目前为止我尝试过的是:

  • Converting it into csv and then uploading it via PHPMyAdmin GUI Import option , now I have read blogs and posts to upload this file in UFT-8 character set but this is not working it still gives me '?'. 将其转换为csv,然后通过PHPMyAdmin GUI Import选项将其上传,现在我已经阅读了博客和帖子,以UFT-8字符集上传了此文件,但是它不起作用,仍然给我'?'。 My database character set is also UFT-8. 我的数据库字符集也是UFT-8。
  • Uploading excel directly via PHPmyAdmin GUI import option (character set UFT-8) , still not working. 通过PHPmyAdmin GUI导入选项(字符集UFT-8)直接上传excel仍然无法正常工作。
  • Converting excel spreadsheet into Open spreadsheet document and uploading via PHPmyadmin GUI Import option - This worked the characters were intact., but when I use aggregate functions on database, it does not give me the desired result . 将excel电子表格转换为Open电子表格文档并通过PHPmyadmin GUI导入选项上载-可以正常使用这些字符,但是当我在数据库上使用聚合函数时,它并不能达到预期的效果。 (basically it increases my trouble going further) (基本上,这增加了我进一步前进的麻烦)

If someone can help me to solve this problem with CSV import , I would really appreciate it because moving forward user will be uploading the CSV and I can easily import data in MYSQL with 'LOAD DATA INFILE' command via PHP. 如果有人可以通过CSV导入帮助我解决此问题,我将不胜感激,因为向前的用户将上传CSV,并且我可以通过PHP的“ LOAD DATA INFILE”命令轻松地在MYSQL中导入数据。

Example of special characters : ' ² ' (square symbol). 特殊字符的示例:'²'(方形符号)。

我认为您可以尝试以下方法phpMyAdmin UTF-8 ,数据源,连接,数据库,php代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM