I was surprised to find people registering usernames with chinese characters, given the wording of the description of the username field on the registration form:

"Your full name or your preferred username; only letters, numbers and spaces are allowed."

which, I believe, is accurate for western languages.

One possible change:

"Your full name or your preferred username; only letters, characters, numbers and spaces are allowed."

might be a bit confusing to western readers, so my suggestion would be to change the wording to talk about which characters are disallowed:

"Your full name or your preferred username. Punctuation is not allowed."

Comments

morbus iff’s picture

I'd support a patch implementing this.

Wesley Tanaka’s picture

Status: Active » Needs review
StatusFileSize
new2.82 KB

This also fixes the problem where one of the messages was using a semicolon while the other was using a colon.

moshe weitzman’s picture

why do we say 'your full name' here. i think people are well aware what a username is by now.

dries’s picture

Status: Needs review » Reviewed & tested by the community

I'm cool with this patch.

drumm’s picture

Status: Reviewed & tested by the community » Needs work

Doesn't apply to HEAD.

vjordan’s picture

Version: x.y.z » 5.x-dev
Status: Needs work » Needs review

updated patch based which follows moshe witzman's comment. Dialog will now read:

Your preferred username: Punctuation is not allowed.

Patch created against HEAD revision on 7 December 2006. Seems to work fine for me but my first effort at creating a patch so needs a good review.

vjordan’s picture

StatusFileSize
new617 bytes

patch attached

dries’s picture

The use of the word 'punctuation' sounds ... weird. (Also, the word 'punctuation' shouldn't be capitalized.)

ChrisKennedy’s picture

Priority: Minor » Normal
StatusFileSize
new4.61 KB

This bug was duplicated at http://drupal.org/node/101049 where I have also posted a patch. Reposting here:

Periods, dashes, and underscores are all allowed actually.

In researching username validation I also discovered that the maxlength is incorrectly set to 56 when the database length is 60. This patch fixes the error by abstracting the length to a constant USER_MAX_LENGTH, which will make it easy to increase in the future and reduces the need for translation changes. I did the same for the email address.

There does not seem to be a reason for setting the username max at 56 rather than 60. The original commit that increases the maxlength from 32 to 56 is here: http://cvs.drupal.org/viewcvs/drupal/drupal/modules/user.module?r1=1.26&...

I also did a grep on modules/* and includes/* but didn't find any other references to the 56 character limit.

vjordan’s picture

Looking like a good improvement.

The original issue concerned the use of non-western character sets, where some valid usernames included Chinese characters which would not normally be labelled as "letters" or "numbers". Also note moshe weitzman's good suggestion to simplify the guidance.

Form 1 of the string which would cover the second point:

Your preferred username: only letters, numbers, spaces, periods, dashes, and underscores are allowed.

Form 2 of the string which might also cover the original issue (but could possibly confuse people?):

Your preferred username. The following special characters are permitted "." "_" "-" " "(space).

I can live with either of the above.

ChrisKennedy’s picture

Title: when registering a new account, the wording of the description for the username field is a bit misleading » String freeze: description for the username field is a bit misleading
StatusFileSize
new789 bytes

I took out the username/email length junk as it should be a separate issue.

Patch uses "Your preferred username: only letters, numbers, spaces, periods, dashes, and underscores are allowed."

Wesley Tanaka’s picture

To address the original issue, would it make sense to add "characters" to the list of things which are allowed?

Wesley Tanaka’s picture

Sorry, that was unclear. What I mean is, would it make sense to use the description:

Your preferred username: only letters, characters, numbers, spaces, periods, dashes, and underscores are allowed.

ChrisKennedy’s picture

-1 to characters as they are not needed.

It only makes sense when you're mapping from a strange username -> allowed input, not allowed input -> possible usernames (which is what the users are doing). As you say in the original bug report, without a frame of reference it's unclear what differentiates characters from numbers and letters.

Wesley Tanaka’s picture

Indeed, there is potential confusion. How about the form of the description that describes what is not allowed, then, maybe something like "punctuation is not allowed except for periods, hyphens, and underscores"

ChrisKennedy’s picture

StatusFileSize
new787 bytes

Alright, that's fine.

Steven’s picture

The original issue concerned the use of non-western character sets, where some valid usernames included Chinese characters which would not normally be labelled as "letters" or "numbers". Also note moshe weitzman's good suggestion to simplify the guidance.

Unicode classifies ideographic Chinese characters as "Letter, other", so "letters" is not too bad.

Perhaps we could say: "Use only words and numbers. Punctuation is not allowed except for a period, hyphen or underscore."

Wesley Tanaka’s picture

Calling chinese characters "letters" doesn't reflect common usage. Not sure how to go about demonstrating that, but here are some google result count estimates:

Results 1 - 100 of about 1,320,000 for "chinese characters". (0.12 seconds)
Results 1 - 100 of about 76,600 for "chinese letters". (0.32 seconds)
(interestingly, result #2 of the second search for me is titled "chinese letters" in order to explain that chinese letters do not exist)

If unicode calls characters letters (not "glyphs?"), then "Use only unicode letters and numbers. Punctuation is not allowed except for a period, hyphen or underscore." would be clear, but too technical.

What about: "Use only characters and numbers. Punctuation is not allowed except for periods, hyphens, and underscores."

vjordan’s picture

Not so sure about the use of "characters" as this includes all the special characters which are not punctuation yet will not be permitted such as "&", "%" (and many others).

Also an important bit of this string is the

Your preferred username

so let's not lose that.

I wonder if the patch given by ChrisKennedy at #11 will suffice? Despite some semantic imprecision I think it will be sufficient for users. As evidenced by the original issue, those that might wish to work around that imprecision seem to be managing. But English is my first language and this might be why I find the patch text fine. Wesley's view is better informed from a non-Western language perspective.

@Wesley - Is the proposed text confusing and we need to continue to try to find a better wording? Or is it imprecise but otherwise workable?

Wesley Tanaka’s picture

The way I read the patch in #11, it sounds to me like it disallows Asian characters. I just wouldn't realize I could use "letters" other than A-Za-z.

However, I think the patch in comment #16 is good.

Anyway, my original confusion might just be a case of me being unusually dense.

forngren’s picture

I agree with Wesley Tanaka, #11 is/could be confusing. I prefer #16.

vjordan’s picture

#16 sounds fine for me too.

I see the V5 RC is out and there is a statement "With all the user interface strings frozen...". I don't understand the fix and release processes very well. How does this 'fix' get moved forward? More specifically, what can I do to help?

ChrisKennedy’s picture

Status: Needs review » Reviewed & tested by the community

#16 it is then.

Regarding policy, here's what Dries sent to the dev list recently: "String are not 100% frozen yet, but will be when the first release candidate (RC) is made available. Once the RC is out, we'll try not to break strings unless we really have to." So we'll have to see if this bug qualifies as worthwhile or not.

drumm’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)