SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    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:

    PHP Code:
    function alphaNumOnly($dirty){
        
    $dirty str_replace("'","",$dirty); // remove '
        
    $dirty str_replace('"','',$dirty); // remove "
        
    $allowed "/[^あ-んa-z0-9\\040\\.\\-\\_]/i";
        return(
    preg_replace($allowed""$dirty)); 


  2. #2
    SitePoint Addict fattyjules's Avatar
    Join Date
    Dec 2005
    Posts
    295
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you know the character encoding of the string that you are accepting? You might need to use PHP's multibyte functions.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •