Results 1 to 2 of 2
Apr 28, 2009, 20:18 #1
- Join Date
- Aug 2006
- 0 Post(s)
- 0 Thread(s)
whitelist to accept chinese, korean, japanese
I want to make a whitelist to accept only the following text from a form input:
- alphabet (a-z)
- numbers (0-9)
- space ( )
- underscore (_)
- Japanese (あ-ん)
- Korean (? - ?)
- Chinese (? - ?)
As you will see above, I do not know what characters start and end the Korean and Chinese alphabets. Can anyone help?
The function I am using is this:
$dirty = str_replace("'","",$dirty); // remove '
$dirty = str_replace('"','',$dirty); // remove "
$allowed = "/[^あ-んa-z0-9\\040\\.\\-\\_]/i";
return(preg_replace($allowed, "", $dirty));
Apr 29, 2009, 18:02 #2
Do you know the character encoding of the string that you are accepting? You might need to use PHP's multibyte functions.