How can I convert Unicode names to a Normal string?

Viewed 94

Discord allows users and servers to have basically any name with unicode, emojis, etc. I don't need a solution to fix all names but I need to "normalize" as many unicode as I can. I have tried solutions on here but, for some reason, the unicode is simply not being converted. This is what I have right now. I need something like ' ' to become 'Baka Gang'

function unicodeToChar(unicode) {

        const arr = [];

        for (const char of unicode) {
            arr.push(char);
        }

        const newWord = [];

        arr.forEach(letter => newWord.push(String.fromCharCode(parseInt(letter))));

        return newWord.join('');
    }
1 Answers

After many hours of trial and error, I found a solution.

guild.name =

guild.name.normalize('NFKC') = Baka Gang

This allowed me to paint the name with Canvas :)

Related