Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Charinfo fails to link newline characters (and several others) #2611

Closed
bast0006 opened this issue May 26, 2023 · 0 comments · Fixed by #3071
Closed

Charinfo fails to link newline characters (and several others) #2611

bast0006 opened this issue May 26, 2023 · 0 comments · Fixed by #3071
Labels
a: frontend Related to output and formatting a: utility Related to utility commands: (bot, eval, extensions, jams, reminders, snekbox, utils) help wanted Extra attention is needed l: 1 - intermediate p: 3 - low Low Priority t: bug Something isn't working t: enhancement Changes or improvements to existing features

Comments

@bast0006
Copy link
Contributor

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)

@bast0006 bast0006 added t: bug Something isn't working help wanted Extra attention is needed a: frontend Related to output and formatting p: 3 - low Low Priority a: utility Related to utility commands: (bot, eval, extensions, jams, reminders, snekbox, utils) l: 1 - intermediate t: enhancement Changes or improvements to existing features labels May 26, 2023
@wookie184 wookie184 linked a pull request May 23, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: frontend Related to output and formatting a: utility Related to utility commands: (bot, eval, extensions, jams, reminders, snekbox, utils) help wanted Extra attention is needed l: 1 - intermediate p: 3 - low Low Priority t: bug Something isn't working t: enhancement Changes or improvements to existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant