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

Provide Unicode character Classification and Character name in details. #409

Open
bcowgill opened this issue Jan 6, 2023 · 1 comment
Open

Comments

@bcowgill
Copy link

bcowgill commented Jan 6, 2023

When showing the details of a unicode character it would be useful to show the character classification and official Unicode character name.

Here's an example for a few characters at U+2325

$ utf8ls.pl U+0073 U+2325
s	U+73	[LowercaseLetter]	LATIN SMALL LETTER S
⌥	U+2325	[OtherSymbol]	OPTION KEY
⌦	U+2326	[OtherSymbol]	ERASE TO THE RIGHT
⌧	U+2327	[OtherSymbol]	X IN A RECTANGLE BOX
⌨	U+2328	[OtherSymbol]	KEYBOARD
〈	U+2329	[OpenPunctuation]	LEFT-POINTING ANGLE BRACKET
〉	U+232A	[ClosePunctuation]	RIGHT-POINTING ANGLE BRACKET

You could convert this output into a JSON lookup for each unicode code point to display along with the character.

You can generate a full table in json format with my perl script here:
https://github.com/bcowgill/bsac-linux-cfg/blob/master/bin/utf8ls.pl

> utf8ls.pl --all U+0000 | perl -pne 'BEGIN {print "{\n"} END {print "}\n"} chomp; m{U\+(\w+)\s+(\[\w+\])\s+(.+)}; $u = substr("000$1", -4); $_ = $2 ? qq{"\\u$u": { class: "$2", name: "$3"},\n}:""' > utf8.json

{
"\u0000": { class: "[Control]", name: "NULL"},
"\u0001": { class: "[Control]", name: "START OF HEADING"},
"\u0002": { class: "[Control]", name: "START OF TEXT"},

or I can provide it if you cannot run perl

@nbros
Copy link

nbros commented Nov 28, 2024

Yes please, it took me a while to understand what I was seeing with multibyte UTF-8 characters representing a non breakable space, which of course shows up blank currently. It would become evident if it showed instead something like "UTF-8 ' ' : No-Break Space (NBSP)"

I think the original list of character names is:
https://unicode.org/Public/UNIDATA/UnicodeData.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants