Closed Finii closed 1 year ago
WAT?!
I can hardly believe that "JSON and other text files" can not use the 5 digit hex values. Sure enough I can still enter it directly on any text prompt (via shift
+ctrl
+u
f
0
2
4
b
enter
(linux)).
Are you sure that JSON can just UTF-16? Is there any spec page?
In text files I usually either have the concrete glyph typed in or use the nf-md-folder
name id thing :thinking:
Which files support "\uFFFF" (but not "\uFFFFFF")?
Edit: Don't get me wrong, I'm not angry with you, but with JSON ;-) Thanks for reporting.
[later]
Ok, some online JSON editor at least just parses the first 4 digits :unamused:
So a change for the cheat sheet is indeed useful.
This is how it looks right now
That would mean we need an additional field for UTF16 encoded or something.
I do hate web page programming :grimacing:
In principle we could rename Hex
to UTF16
and place the \u....
there.
To copy just the code one could click on the code in the bottom right corner (which is 'dead' right now).
:thinking:
Moved the discussion here to separate the issues.
@Finii we went through the same experience 😂. For reference, this is where you can find that information in the spec, specifically in the last paragraph.
To escape an extended character that is not in the Basic Multilingual Plane, the character is represented as a twelve-character sequence, encoding the UTF-16 surrogate pair. So, for example, a string containing only the G clef character (U+1D11E) may be represented as "\uD834\uDD1E".
@JanDeDobbeleer Is it really possible to use two \u
to create one code?
My shell's echo
and printf
check the code provided to \u
and of course the codes are in the forbidden range.
Instead I need to use \U
or UTF8 and \x
(raw codes), see https://github.com/ryanoasis/nerd-fonts/discussions/1077#discussioncomment-4775535 (bottom)
Edit: What I want to say: Maybe it makes more sense to provide UTF8 codes instead of UTF16?
@Finii yes, from JSON in my tests that works without issues.
yes, from JSON in my tests that works without issues.
But what about UTF8, as that solves more usecases, is that good for you too?
I guess putting a two \u
sequence that works in some places and not in others is not so nice; and the space is limited, we would need the UTF8 coding maybe anyhow?
@Finii just tried UTF-8 encoding and that doesn't output anything coming from JSON. And unlike the \uxxxx
notation I have to escape the \
. And, as stated in the official RFC, this isn't mentioned as supported at all.
Just finished the code to copy the utf16 stuff instead of hex. Let me push it.
Need to make a 'copy hex' thing for the hex display in the bottom right. Anyone a js freak? ;-)
You can try it, do not forget to update your page-cache by shift-reload or something.
Need to make a 'copy hex' thing for the hex display in the bottom right.
Done
@Finii the codes are correct however it doesn't seem to copy \u
, for example, I get db80 de4b
for nf-md-folder
. I would expect \udb80\ude4b
Aeh, pfff, well I though people would add that themselves? It would be a trivial change... Hmm. maybe a good addition
Done via d428bd7af eda8f0b5, do not forget to shift-reload if you wanna try
Strange code, why is c
not reused?
Who wrote that code ;-D
Edit: Fixed now in eda8f0b
@Finii amazing work, I'm impressed 🚀
Just saw you 'are' oh-my-posh, I think many people raising issues here use that. I'm not sure if you have prepared codepoints for the prompts, but of course you are aware that the old material design icons will be dropped with Nerd Fonts v3?
https://github.com/ryanoasis/nerd-fonts/blob/master/changelog.md#next-release-outlook
@Finii I am, that's how I came to report this. What I'm still looking for is a way to migrate. I don't suppose you have a list of old vs new code points?
Quickly, with some sed
, sort
and uniq
magic:
(unchecked)
Edit: Add one final sort
open to see the list "old to new codepoint of material design icons":
cat temp/2017-01-04-icon-cheat-sheet.md| grep "class-name\">nf-mdi-" | sed -E 's/.*ss-name">nf-mdi-//;s/<\/div>.*"codepoint">/ /;s/<\/div>$//' | sed -E 's/([^ ]*) (.*)/\2 \1/' > MDI
cat temp/2017-01-04-icon-cheat-sheet.md| grep "class-name\">nf-md-" | sed -E 's/.*ss-name">nf-md-//;s/<\/div>.*"codepoint">/ /;s/<\/div>$//' | sed -E 's/([^ ]*) (.*)/\2 \1/' > MD
wc MD*
cat MDI MD | sort -k 2 -r | uniq -f 1 -D | sed -E 'N;s/\n^(f....) .*/ \1/' | sort -k 2 | sed -E 's/([^ ]*) ([^ ]*) (.*)/\1 \3 \2/' | sort | xclip
To create the temp/
file:
cd bin/scripts
./generate-css.sh
@Finii I'm going to try to add a migration in oh-my-posh so people can easily convert their configs to the new code points.
Maybe noteworthy is also #1061, where I have no solution but I bet ppl will complain :grimacing:
@Finii I noticed that as well and yes, this is an issue storm waiting to happen everywhere.
@Finii I'm done with the migration code but I noticed something. In your list it shows fcd1
, but that one can still be found in the cheat sheet. It converts to another go language icon, so I'm wondering if the set is correct.
The list just follows the glyph names they provide, and obviously they changed the appearance completely. Note also that the name is the same (and we get the names from upstream):
If people want to retain the outdated/obsolete Go logo (Go changed their logo) they can use seti instead:
(Hmm, the seti one looks different, I guess it's self-intersecting :unamused:)
Obviously Seti
took the black-on-white logo and just inverted it, while MDI
had a complete redraw:
Some glyphs seem to be dropped
beats and behance in this case.
Did not check systematically.
Quickly, with some
sed
,sort
anduniq
magic:(unchecked)
Edit: Add one final sort
open to see the list "old to new codepoint of material design icons":
I built a small python script to convert my configs and scripts. Seems to work for me. Maybe it is helpful for someone else. https://gist.github.com/mischw/78e8e42c2ebb1069560a2fc4573b1425
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a new issue, complete the issue template with all the details necessary to reproduce, and mention this issue as reference.
Originally posted by @JanDeDobbeleer in https://github.com/ryanoasis/nerd-fonts/issues/365#issuecomment-1398110379