#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2002
    Posts
    607
    Rep Power
    13

    Javascript check for non-english chars?


    I want to be able to check for non-english characters (ie: japanese chars) in a javascript form validation script.

    Any ideas on how I'd go about this?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    191
    from this point of view, "english" characters are:
    [a-z][A-Z], and the punctuation.

    you can match using a regular expression.
    Code:
    if (!inputstring.match('/^[a-zA-Z \.\!\?]*$/')) {
      alert('Non-english chars detected.');
    }

IMN logo majestic logo threadwatch logo seochat tools logo