Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

check for characters and spaces using ASCII fails for other languages

 
koushik Rock
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If we allow only chars and spaces we usually compare ASCII values in javascript. But what if we support multiple language, the check fails to work. Please advise me on this, any other way considering other languages too...
The javascript we usually use is like that -->
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume that when you said "chars and spaces" you really meant "letters and spaces"?

Well, if you want to extend that algorithm to all letters then you're going to have to go through the Unicode code charts and find out which scripts you want to support letters from. (Hint: there's a lot of scripts covered by Unicode.)

Or you could look for code from somebody else who has already solved the problem. But if it were me I would be reviewing why somebody had required "only letters and spaces" in the first place.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic