miniBB ®

miniBB

®
Support Forums
  
 · Start · Sign in · Register · Search · Statistics · File Bank · Manual ·
How To miniBB Support Forums / How To /  
 

How to preserve accents (and other diacritics) in username during registration ?

 
Author salif
Partaker
#1 · Posted: 30 Aug 2026 16:59
Hello everyone from Paris, France. :)

I managed to have a smell community in line with the help oh miniBB.
The community is mostly french people and it will be more accurate to have their real name as username.

So, what can I write in the $userRegName variable to have all this french (and, later, European) stuff ?

Thanks ! :)

Author Paul
Lead Lead Developer
#2 · Posted: 31 Aug 2026 16:01
I suppose, at first you should have set your forum in UTF-8.

Then also save setup_options.php in UTF-8 encoding.

And then specify all possible chars with French accents in $userRegName.

Example:

$userRegName="A-Za-zàâçéèêëîïôûùüÿñæœ0-9_' -.";

Author salif
Partaker
#3 · Posted: 31 Aug 2026 17:11
OK, I'm going to try this. Thanks ! :)

(and, yes, I'm all on UTF-8)

Author salif
Partaker
#4 · Posted: 1 Sep 2026 11:24
Well, it doesn't work. The registration form still complains.

Is there something else to check ?

(The database is mariadb on Debian)

Thanks.

Author Paul
Lead Lead Developer
#5 · Posted: 2 Sep 2026 13:06
salif:
The registration form still complains.
What is the error message the form displays?

I'm pretty sure it works. I've made the same setup on miniBB demo and registered an account named Hélène.

French username demo

You can try on your own.

Database is not the reason. The validation of the username containing specified chars only is executed in PHP.

Author salif
Partaker
#6 · Posted: 2 Sep 2026 14:27
I have tried the demo and the message is :

Username's length should be from 3 to 15 chars, and it should consist of latin letters (from «A» to «Z» lowercase/uppercase), numbers (from «0» to «9»), the following symbols allowed: «_», «-», also a space, an apostrophe, and a dot (each one only per username). Username can not consist of the numbers only, it should not start or end with a specific character, should not contain multiple repeated characters. Please, verify it and try again!

To be complete, it works if the accent is part of the name (as Hélène) but it does not work if the accent is the first letter of the name (as émilien) or if this first letter is capitalzed (as Émilien).

I have tried to add the character "É" but it has no effect except the same error (but in french).

Thanks for your time. :)

Author Paul
Lead Lead Developer
#7 · Posted: 2 Sep 2026 16:30
salif:
it does not work if the accent is the first letter of the name (as émilien) or if this first letter is capitalzed (as Émilien)
Oh! I've got it now.

At first — you are right — the initial setting should have both capitalized and regular letters defined separately:

$userRegName="A-Za-zÀÂÇÉÈÊËÎÏÔÛÙÜŸÑÆŒàâçéèêëîïôûùüÿñæœ0-9_' -.";
Second, you have to extend bb_specials.php with the function regarding your forum specifics:

1) Save bb_specials.php in UTF-8

2) Closer to the end of this file before ?> re-compose the following default function (listed as of miniBB 3.7.2 — but I've marked the fragment which differs from default):

function verifyUsername($uname){
//should contain only pre-defined symbols
if(!preg_match("#^[".$GLOBALS['userRegName']."]+$#", $uname) or strlen_unicode($uname)<$GLOBALS['umin'] or strlen_unicode($uname)>$GLOBALS['umax']) return FALSE;
//should not consist of digits only
elseif(preg_match("#^[0-9]+$#", $uname)) return FALSE;
//should be sensful alphanumerical
elseif(preg_match("#^([0-9]+)(.*)$#", $uname)) return FALSE;
//should not consist of repeated character only (like '______' etc.)
elseif(count_chars_unicode($uname)<=1) return FALSE;
//should start only with an allowed character, and not with '_'
elseif(!preg_match("#[A-Za-zÀÂÇÉÈÊËÎÏÔÛÙÜŸÑÆŒàâçéèêëîïôûùüÿñæœ0-9]#", substr_unicode($uname,0,1)) or !preg_match("#[A-Za-zÀÂÇÉÈÊËÎÏÔÛÙÜŸÑÆŒàâçéèêëîïôûùüÿñæœ0-9.]#", substr_unicode($uname, strlen_unicode($uname)-1, 1))) return FALSE;
//should contain only one apostrophe, or one space, or one underscore, or one dash per username
elseif(substr_count($uname, "'")>1 or substr_count($uname, '-')>1 or substr_count($uname, '_')>1 or substr_count($uname, ' ')>1 or substr_count($uname, '.')>1) return FALSE;
else return TRUE;
}
You could also then introduce your own limits or extensions regarding usernames in this function.

salif:
I have tried the demo and the message is
Yes, it's a default message and I didn't change it for this exact demo purpose — but on your side, you should preferably update it in the language pack — $l_userErrors[1].

Author Paul
Lead Lead Developer
#8 · Posted: 2 Sep 2026 16:35
You can test it on miniBB demo btw, these changes are applied there now.

Author salif
Partaker
#9 · Posted: 2 Sep 2026 17:03
Wow, just perfect !

It now works as intended.

Thanks a lot for this help !

Greetings from Paris ! :)

Author Paul
Lead Lead Developer
#10 · Posted: 2 Sep 2026 17:29
Glad it helped!

Thanks for your feedback, and good luck using miniBB 😊

How To miniBB Support Forums / How To /
 How to preserve accents (and other diacritics) in username during registration ?
Share Link Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Get the File and Picture Attachments add-on: extend your miniBB-forums, attaching images and files.