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?
+1
A:
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?
troelskn
2009-01-19 10:49:08
A:
BTW, if a user inserts something in our DB, I need it to be written in understandable alphabet by our team and by all of our customers, for a lot of reasons. Even if this would discourage users from other countries...
If you need to update your question, edit it, don't post answers.
TravisO
2009-01-19 18:52:40
You might have already forgotten, but you need to have 50rep to do this. :)
Alex B
2009-01-19 22:04:12
A:
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.
TravisO
2009-01-19 18:52:22