Emoji in Username



  • I have a custom Auth system connected to NodeBB, which allows Emoji to be used within the username. This is causing problems when it tries to create the matching account within the forum.

    I have nodebb-plugin-emoji-extended enabled.

    Is there any way to allow Emoji within the username field?

    Cheers.


  • Anime Lovers

    @snodejoke said in Emoji in Username:

    orum.

    It's like a funny story, as many of the companies started to write emojis instead of letters do decorate their slogan or websites.
    But I don't think using emojis as username is a good idea.



  • I agree with you about Emojis in usernames not being a good idea.
    Unfortunately, this is an existing feature in the community and so will need to be handled by the forum in order for it to integrate.

    :crying_cat_face:



  • Does anyone have any insight into if this would be possible with a plugin?

    @julian / @baris Do you have any suggestions?

    Thanks.


  • Gamers

    Usernames aren't limited to ASCII, as you can also register Chinese usernames (for instance, try 你好 ). I suppose it's possible to register usernames containing emoji unicode characters (💩). However, these usernames cannot be registered. The form disallows the use of these characters, and maybe there are also server-sided checks. In order to allow these characters, removing the checks (unsafe) or adding emoji characters to the checks (safe) from the source code would suffice.

    But keep in mind that the character 💩 is different than :poop:, as the first one is unicode and the second one an image. Whatever emoji you want to use, it will have a unicode equivalent.


  • Gamers

    @JasperNL said in Emoji in Username:

    Usernames aren't limited to ASCII, as you can also register Chinese usernames (for instance, try 你好 ). I suppose it's possible to register usernames containing emoji unicode characters (💩). However, these usernames cannot be registered. The form disallows the use of these characters, and maybe there are also server-sided checks. In order to allow these characters, removing the checks (unsafe) or adding emoji characters to the checks (safe) from the source code would suffice.

    But keep in mind that the character 💩 is different than :poop:, as the first one is unicode and the second one an image. Whatever emoji you want to use, it will have a unicode equivalent.

    You can start with tweaking the client-sided script:
    https://github.com/NodeBB/NodeBB/blob/master/public/src/client/register.js

    The function you will need to tweak is validateUsername. The problem with unicode emoji appears to be that utils.slugify does not seem to allow those characters. I think it's best to start with tweaking utils.slugify. You can find that in this file, line 77.
    https://github.com/NodeBB/NodeBB/blob/master/public/src/utils.js


  • Admin

    Thank you for the insightful analysis @JasperNL :smile:

    If a PR is made to update the server-side checks to allow the unicode range for emoji (and just this range), that will likely be merged. I do not see an issue with allowing it.

    We do want to blacklist other ranges that could potentially be troublesome, like zero-width spaces, etc...



  • Thanks a lot @JasperNL, that's really helpful.

    If I get some availability any time soon, I'll sort out a PR for accepting the emoji unicode range.


Log in to reply
 

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.