简体   繁体   English

PHP / MySQL 特殊字符问题 Â

[英]PHP / MySQL special characters issue Â

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.我遇到了一个非常奇怪的问题......我正在创建一个网站并将数据存储在mysql并且数据来自数据库中不同类型的源。 But the text and html I am storing is not clean.但是我存储的文本和 html 不干净。 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.现在,当我将其呈现为 html 时,如何使用 php 清理这些数据。 I used trim() and html_entity_decode() .我使用了trim()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/这是我的 phpmyadmin 截图: http : //postimg.org/image/ze8umokej/

And here is a screenshot of my page source : http://postimg.org/image/rdz5bxsuj/这是我的页面源的屏幕截图: http : //postimg.org/image/rdz5bxsuj/

I prepared a regular expression and replaced it with balnk.我准备了一个正则表达式并用 balnk 替换它。

$str = "Â some text";

echo $str = preg_replace('/[^\x00-\x7F]/',"",$str);

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

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