简体   繁体   中英

php: how to use strip_tags with UTF8?

echo $src;

gives:

4960 MALMEDY

Then when I apply echo strip_tags($src);

gives me:

4960Â MALMEDY

The SPACE was replaced by  character:

What Do I do wrong ?

It looks that if I use

$src = utf8_decode($src); strip_tags works correctly.

Any rule I should know when to apply utf8_decode ?

请试试这个

   $text_top = strip_tags(trim(html_entity_decode($str,   ENT_QUOTES, 'UTF-8'), "\xc2\xa0"));

尝试:

header('Content-type: text/plain; charset=utf-8');

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