Locked Solved Bug reports

Username with unsupported characters

Locked by Fred · 02 Jan 2026 20:28 • Solved by Fred · 02 Jan 2026 20:28
Avatar
Posts 6

Hello,first of all, I would like to thank you for your work! Thank you!

I would also like to report a minor error—the registration form allows me to enter any characters, spaces, and characters with diacritical marks. The registration process completes successfully. However, the user's page cannot be displayed because the URL contains the user's full name, including unsupported characters.

Have a nice day, Patrik Čmejla

  • username
Avatar
Best answer set by Fred 1 month ago
Posts 243

Hi Patrik, Thank for your feedback.

Username Validation Implementation

Changes Made

1. Server-Side Validation

  • RegisterController: Added regex validation to only allow letters, numbers, hyphens (-) and underscores (_)
  • ProfileController: Same validation applied during profile updates
  • UserManagementController: Same validation applied during admin modifications

2. Translation Messages

  • Added username_invalid_format in both French and English in error translation files

3. Client-Side Validation (HTML5)

  • Added pattern="[a-zA-Z0-9_-]+" attribute to all forms:
    • Registration forms (register.php and register-modal.php)
    • User settings forms (settings.php)
    • Admin edit forms (admin/users/edit.php)
  • Added title attribute with appropriate error message

4. JavaScript Validation

  • Fixed JavaScript patterns in settings.php to include hyphens: /^[a-zA-Z0-9_-]+$/

Result

Usernames can no longer contain spaces or diacritical characters. Only alphanumeric characters, hyphens, and underscores are allowed, ensuring that profile URLs work correctly.

The issue with "Patrik Čmejla" is resolved: during registration, the system will reject this username and request a valid format.

Allowed Characters

Allowed:

  • Letters: a-z, A-Z
  • Numbers: 0-9
  • Hyphen: -
  • Underscore: _

Not allowed:

  • Spaces
  • Diacritics (é, à, ñ, č, etc.)
  • Special characters (@, #, !, etc.)

Examples

UsernameValid?
John_Doe✅ Yes
user123✅ Yes
my-username✅ Yes
Patrik Čmejla❌ No (space + diacritic)
user@example❌ No (@ symbol)
jean-marie✅ Yes
Avatar
Posts 67

patrikcmejla

URL's should NEVER have special characters and that causes a security risk. Also browsers can't read special characters through the URL.

Avatar
Posts 6

Gavin

I really don't understand your answer. I am neither a programmer nor the author of this forum.

Avatar
Posts 6

Fred

I apologize, in today's information-saturated world, I did not pay attention to other posts. Thank you and I apologize.

Avatar
Posts 67

patrikcmejla

URLs can only support colon (":"), forward slash ("/"), question mark ("?"), hash ("#"), left and right square brackets ("[" and "]"), at symbol ("@"), exclamation mark ("!"), dollar sign ("$"), ampersand ("&"), single quote ("'"), parentheses ("(" and ")"), asterisk (""), plus ("+"), comma (","), semicolon (";"), and equal sign ("="). Example: (Č) is a non-ASCII character which means the URL is reading U+010C or in UTF-8 encoding 0xC4 0x8C. Overall what I'm trying to say is that the browser is reading the folder as a UTF-8 encoding and not in Latin-2 encoding. Which is why its not working.

This discussion is locked

Log in to reply
navigation.title
6Posts
post #1
20 Dec 2025
ByUtilisateur