Detect and filter user input depending on charset
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.
精彩评论