Search code examples
javascriptphpwebnon-ascii-characters

Should I ensure characters in user input follow ASCII?


I am writing an online form which I am checking client-side through JavaScript and server-side through PHP though was wondering, should I be validating that the user doesn't include non-ASCII characters?

For instance, is there any way that programming languages would throw errors or give me any problems if I don't handle these characters - or should they be capable of dealing with them?

Thanks in advance.


Solution

  • Don't limit your users to ASCII unless there is a good reason to do so. UTF-8 encoded Unicode is supported by almost everything, so stick with that unless there's a good reason not to.

    If you're not familiar with character encoding, I'd recommend this article: http://www.joelonsoftware.com/articles/Unicode.html