-
-
Notifications
You must be signed in to change notification settings - Fork 726
Description
Currently, the !charinfo command runs unicodedata.name()
to figure out what name a character should be given. However, unicodedata.name()
does not support control characters like the newline characters such as \n, the null character, or a variety of other ones that have unicode names as aliases but not official "recognized" names which are often "" for some reason.
There's an open bug on cpython for a few years now, but it doesn't look like there's much activity (python/cpython#71683)
Unfortunately it doesn't look like there's an easy standard library hack either (please correct me if I'm wrong!) because unicodedata
is generated C, then compiled, and the only interface to the data is through lookup functions (and we'd want to go the other direction, from character to aliases). I've also had no luck in looking at additional libraries, so any actual solution to this might just fall down to a hardcoded list.
At the very least, we should consider "cleaning up" the output so that instead of injecting empty space we use the character id perhaps like \0x0a
, for newline, for the link name so it doesn't visually break?
(ex: https://discord.com/channels/267624335836053506/635950537262759947/1111690082441769011)