开发者

Detect and filter user input depending on charset

开发者 https://www.devze.com 2022-12-15 15:39 出处:网络
I am trying to filter user input depending on their charset. I am displaying keywords from user inputs to other users but to not want to display e.g. arabic or chinese characters but only english/lati

I am trying to filter user input depending on their charset. I am displaying keywords from user inputs to other users but to not want to display e.g. arabic or chinese characters but only english/latin characters.

How can I do that with PHP? Is there a easy solution o开发者_开发百科n doing this?

Thanks.


Use the mb_detect_encoding function to detect the charset.

This requires the Mbstring extension to be active in PHP, which it is on most servers.

0

精彩评论

暂无评论...
验证码 换一张
取 消