How can I test if an input field contains foreign characters?
Posted
by zeckdude
on Stack Overflow
See other posts from Stack Overflow
or by zeckdude
Published on 2010-03-23T11:34:42Z
Indexed on
2010/03/23
11:43 UTC
Read the original article
Hit count: 149
I have an input field in a form. Upon pushing submit, I want to validate to make sure the user entered non-latin characters only, so any foreign language characters, like Chinese among many others. Or at the very least test to make sure it does not contain any latin characters.
Could I use a regular expression for this? What would be the best approach for this?
I am validating in both javaScript and in PHP. What solutions can I use to check for foreign characters in the input field in both programming languages?
© Stack Overflow or respective owner