dongye9182 2015-10-03 04:14
浏览 53
已采纳

PHP / MySQL特殊字符问题Â

I am getting a very strange problem... I am creating a website and storing data in mysql and data is phrased from different types of sources in the database. But the text and html I am storing is not clean. It's also saved some special characters and and extra space. Now how can I clean this data with php when I render it as html. I used trim() and html_entity_decode().

These functions removed some white spaces but I still can't clean these  characters.

Here is screenshot from my phpmyadmin : http://postimg.org/image/ze8umokej/

And here is a screenshot of my page source : http://postimg.org/image/rdz5bxsuj/

  • 写回答

1条回答 默认 最新

  • duanpo6079 2015-10-03 04:30
    关注

    I prepared a regular expression and replaced it with balnk.

    $str = "Â some text";
    
    echo $str = preg_replace('/[^\x00-\x7F]/',"",$str);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥60 许可证msc licensing软件报错显示已有相同版本软件,但是下一步显示无法读取日志目录。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系