简体   繁体   中英

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. 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/

I prepared a regular expression and replaced it with balnk.

$str = "Â some text";

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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