fdomig
fdomig

Reputation: 4457

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 on doing this?

Thanks.

Upvotes: 0

Views: 308

Answers (1)

Emil Vikström
Emil Vikström

Reputation: 91912

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.

Upvotes: 2

Related Questions