duan0531 2014-04-10 00:55
浏览 30
已采纳

字符显示正常然后插入带有问号的mysql [重复]

This question already has an answer here:

I'm trying to parse a text file using PHP.

In my database I have data which shows in phpmyadmin like this Triste o melancólico

And once it's retrieved it displays just fine on my website.

Now the issue has come when I try to parse this text file. I will have a word such as Etimología

Now I load the text file, parse it and if I echo the parsed data to the page it will display fine, no question marks / unwanted characters in replace of the í. The thing is if I go to insert the data into my db the special character í is being switched over to a question mark.

I've tried using

mysql_query("SET CHARACTER SET utf8");

After my sql connection but it did not make a difference.

Does anyone have any ideas as to why new text with special characters are being inserted as question marks, when pre existing text with special characters is working just fine?

Thanks

</div>
  • 写回答

1条回答 默认 最新

  • donglu7816 2014-04-10 01:05
    关注

    Try some different set in your mysql database for example utf8_general_ci or utf8_unicode_ci only if utf8_general_ci didn't work :

    1. Log to phpMyAdmin. Select the database from the list on the left.
    2. Click "Operations" from the top set of the tabs.
    3. In the Collation box, choose the new collation from the dropdown menu utf8_general_ci is fine but if you have it already and you still have the problem then try to use utf8_unicode_ci maybe it will solve your problem.
    4. Click Go and see if it solve your problem

    Hope this will help you.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥15 统计大规模图中的完全子图问题
  • ¥15 使用LM2596制作降压电路,一个能运行,一个不能
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路
  • ¥15 phython读取excel表格报错 ^7个 SyntaxError: invalid syntax 语句报错
  • ¥20 @microsoft/fetch-event-source 流式响应问题
  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式