Change the glyphs type from Rune to string.
See original GitHub issue > > One thing come on mind is to change all glyphs to string. This will be more easy to manipulate with text. What do you think?
I only asked because some glyphs may be set with more than one code point, like the Man, Woman and Girl emoji 👨👩👧, which is presented with
"\U0001F468\u200D\U0001F469\u200D\U0001F467"
string and cannot be displayed with only one code point.
Good call. Please open an issue and I’ll do that!
_Originally posted by @tig in https://github.com/gui-cs/Terminal.Gui/issues/2620#issuecomment-1546813406_
@tig for surrogate pairs code points please use the encoded code point e.g. Man
👨 or "\U0001F468"
, instead of the decoded two surrogate pairs ("\ud83d\udc68"
).
Issue Analytics
- State:
- Created 4 months ago
- Reactions:1
- Comments:8
Top Results From Across the Web
Golang converting from rune to string
If you just want to convert a single rune to string , use a simple type conversion. rune is alias for int32 ,...
Read more >Convert between rune array/slice and string
When you convert a slice of runes to a string, you get a new string that is the concatenation of the runes converted...
Read more >How to Convert Rune to String in Golang - AskGolang
To convert a rune to a string, you can use the "string()" function. In Go, a rune is an alias for the int32...
Read more >Golang Program to Convert Character to String
This function takes the rune value as an input and converts it to return the output as a string.
Read more >Stupid Simple Question about strings and runes : r/golang
the compiler keeps yelling at me for the if statement that it cannot convert "(" (type untyped string) to type rune.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The
RuneJsonConverter
must check if a rune with two surrogates has a valid surrogate pair, which has a valid high surrogate and a valid low surrogate, otherwise shouldn’t accept it. A alone high surrogate or a alone low surrogate aren’t accepted. If a rune is composed by various non surrogate it may be a valid string, or if it’s composed by valid surrogate pairs and with non surrogate, it may be a valid string.After first
Rune
->string
inGlyphDefinitions
and realizing this makes USING the glyphs awkward (Rune x = CM.Checked.ToRunes() [0]
or similar alternatives), I think the right thing to do is leaveGlyphDefinitions
to continue to useRune
as the property type, but enhanceRuneJsonConverter
to support specifying as a string with a low and high surrogate (or any # of them).This will all be valid:
I will introduce both unit tests and exceptions if a property in
GlyphDefinitions
cannot be normlized to a single rune (usingRune.TryCreate
). These will fail:Note, technically, backticks (') are not valid JSON for specifying strings. But most JSON parsers including System.Text.Json let it happen. We cannot detect what the input is.
etc…