简体   繁体   English

是否知道诸如strip_tags()和trim()UTF-8这样的函数?

[英]Are functions like strip_tags() and trim() UTF-8 aware?

I'm wondering whether functions like strip_tags() and trim() UTF-8 aware? 我想知道是否有诸如strip_tags()trim()类的函数支持UTF-8?

I found this on the web, but I'm not sure about it: 我在网上找到了这个,但是我不确定:

strip_tags() : multi-byte UTF-8 characters contain no byte sequences that resemble less-than or greater-than symbols. strip_tags() :多字节UTF-8字符不包含类似于小于或大于符号的字节序列。

trim() : multi-byte UTF-8 characters contain no byte sequences that resemble white space. trim() :多字节UTF-8字符不包含类似于空白的字节序列。

If it's true, using those functions with an UTF-8 string could lead to a corrupted/illegible string. 如果是这样,则将这些函数与UTF-8字符串一起使用可能会导致字符串损坏/难以辨认。

Thank you. 谢谢。

I think the descriptions you quoted mean just the opposite. 我认为您引用的描述恰恰相反。 Because utf8 multi-byte characters DON'T contains whitespace, or lt/gt, or any other byte < 0x80, you can safely use those functions on utf8 strings. 因为utf8多字节字符不包含空格或lt / gt或任何其他<0x80字节,所以您可以在utf8字符串上安全地使用这些功能。 That's the beauty of utf8! 这就是utf8的美!

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

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