im running into an issue where i have an autocomplete option for channel names from my database, but the channel names have unique fonts that make the autocomplete pretty much useless for focused values. is there a js method or package that can help me with this? i tried normalizing with ascii but i cant seem to figure it out
#normalizing channel names with unique fonts
15 messages · Page 1 of 1 (latest)
You mean the emojis? If so you should still be able to index the column to use with an auto-complete feature with your bot.
If you are storing the channel names as utf8_unicode_520_ci or utf8mb4_0900_ai_ci then you'll need to create a prefix index over that column (depending on the database used. I use mariaDB / mysql ) has there is a limit on how it builds indexes on very long character sets so your autocomplete might be breaking because of that.
CREATE INDEX idx_autocomplete_prefix ON your_table (channel_name(100));
Means create an index limiting it to the first 100 characters. This works well with LIKE '%foo' but has terrible performance when used with wildcards LIKE '%foo%'
You can also normalize the search stirng in JS
const normalizedSearch = searchString.trim().normalize("NFC");
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
unfortunately no im referring to custom fonts in chanel names, as discord allows channel names to be rendered as custom copy/pastable fonts. these get stored as text in that font in the api, and when u get channel names they still mantain that font, which makes autocomplete not work for those channels. normalize() doesn't work sadly for this
Are you talking about Unicode characters? Because you can't change the font of channel names
Im not really sure how unicode works, but im assuming even if its a different font shouldnt the character render the same?
For example one of the channels is called 🔒|ᴀɴɢᴇʟ-ʟᴏᴄᴋs
but if i type in "angel" in the autocomplete it doesnt recognize that as the same as the channel
i just want a way to normalize the channel name in any way so i can match and display the channel names with different fonts
That's the same font, but different characters
"Latin Letter Small Capital G" is a different character than "G"
that makes a lot more sense
any easy way that you know of to recognize those other characters as basic letters