Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are user names ever case sensitive?

I'm looking at some code that converts user names to lower case, before storing them. I'm 90% sure this is ok, but are there systems out there that actually require case sensitivity on the user names (specifically in the health industry)?

Note: my particular code is not at the point of entry. We are taking user names from other systems. The worry I have is depending on those systems (which may or may not be under our control) to consistently pass us usernames in the same case as each other (when describing the same user).

Also of note - the code is:

userName.toLowerCase(Locale.ENGLISH)

Are all user names in english? Is this just so it matches collation in the database? Note that (in java at least) String.toLowerCase() is defined as String.toLowerCase(Locale.getDefault())

like image 737
Stephen Avatar asked Feb 12 '09 00:02

Stephen


2 Answers

toLowerCase has only one reason for it to accept a locale:

since small letter i has a dot in every standard language, the letter I is transformed to a i with a dot.

but in turkish, there is also a capital letter İ with a dot above. this is transformed to a small letter i.

the "regular" turkish capital I is transformed to a small ı - without a dot.

so, unless your turkish usernames are all called IiI1I1iiII, i would hardly worry about this.

every other language than turkish has a identical toLowerCaseImplementation. so you could chose Locale.ENGLISH or Locale.GERMAN or whatever..just make sure you do not pick turkish.

see the javadoc for more detailed information

edit: thanks to utku karatas i could/copy paste the correct glyphs in ths post.

like image 174
Andreas Petersson Avatar answered Sep 19 '22 15:09

Andreas Petersson


unix logins are case sensitive...

Are there any other systems that do this?

like image 36
Stephen Avatar answered Sep 22 '22 15:09

Stephen