Question : Restrict usernames to url encode-safe characters?

Hi,

I'm writing a web app, and when users signup, I want to make sure their chosen usernames only contains letters and numbers. This is a bit tricky though with different localizations and such. I need to make sure that the user's chosen username doesn't mess up urls and stuff like that when I try printing it in webpages.

Is there a pattern for enforcing 'safe' usernames when users sign up? I'm using java, and basically need some pattern to check if a username conforms to whatever rules make sense for a web app,

Thanks

Answer : Restrict usernames to url encode-safe characters?

If you are going to use their usernames to generate URLs etc, I would then try to stick with the standard ASCII set of characters, no special characters.  A simple approach could be to check that every character is between 0-9,  a-z or A-Z.  Some other characters, like underscore is also allowed in URLs.

Here is a quick link that describes URLs and allowed characters etc.

http://www.blooberry.com/indexdot/html/topics/urlencoding.htm
Random Solutions  
 
programming4us programming4us