2

I need to limit character input in a text field (using ASP.Net/JavaScript/JQuery) to only allow characters in the ISO/IEC 8859-1 charset.

How would I do this?

pac w
  • 647
  • 6
  • 17
  • What have you tried? You should check the data both server-side and client-side. You should also consider whether you really need to restrict data to ISO 8859-1 and not to windows-1252. – Jukka K. Korpela Nov 18 '13 at 14:59

1 Answers1

1

Just set the charset of the page to ISO-8859-1 using <meta charset="ISO-8859-1"> then use a regexp like the following [\x20-\x7E\xA0-\xFF]. The regex will match any visible characters from ISO-8859-1

This answer shows how to restrict input based on regex.

Community
  • 1
  • 1
Hugo Tunius
  • 2,869
  • 24
  • 32