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.
subject: check for characters and spaces using ASCII fails for other languages