Reputation: 21
I have to disable chinese, japanese, cyrillic (and so on) alphabets to be entered by users in my website, at validation time (only server side validation). At the same time I want all latin accented characters to be allowed. I use symfony 1.1 and PHP 5.2, using utf-8, of course. Any hint?
Upvotes: 2
Views: 546
Reputation: 9540
If you need to pick and choose, you won't be able to avoid using regex and/or creating a list of allowed characters.
Yes this is not easy nor quick, but if you want to nit-pick characters, you might need to get specific.
Upvotes: 0
Reputation: 117457
You can always convert to latin1 and then back again. That would discard any non latin1 characters. Eg.:
$str = utf8_encode(utf8_decode($str));
I wonder why you want this in the first place though?
Upvotes: 1