简体   繁体   English

php:如何在 UTF8 中使用 strip_tags?

[英]php: how to use strip_tags with UTF8?

echo $src;

gives:给出:

4960 MALMEDY

Then when I apply echo strip_tags($src);然后当我应用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. strip_tags 工作正常。

Any rule I should know when to apply utf8_decode ?我应该知道什么时候应用 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');

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

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