Fable icon indicating copy to clipboard operation
Fable copied to clipboard

Add supports for `System.Text.Rune` API

Open MangelMaxime opened this issue 8 months ago • 0 comments

Description

For a library I am working on, I will need the System.Text.Rune API.

At the moment here is the API I am using:

rune.* are instance methods / properties

  • Rune.GetRuneAt
  • rune.ToString()
  • rune.Utf16SequenceLength
  • rune.Value
  • c.EnumerateRunes() => I could probably use Rune.GetRuneAt with a while loop to mimic this API

I think the most difficult part will be to get the rune.Value because we need to find how to convert a character/string char into this value.

Once this is done, adding the different properties / static member should not be too difficult. For JavaScript, this file can be a source of inspiration on how to deal with unicode characters especially how to detect the ones using 2 bytes in UTF 16.

// Detect 2 bytes characters
(string.charCodeAt(offset) & 0xF800) === 0xD800

I am creating this issue just to keep track of this future work.

MangelMaxime avatar Jun 25 '24 13:06 MangelMaxime