diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2025-02-27 01:16:26 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2025-02-27 01:16:26 +0100 |
| commit | 9076776696efe1300efd339c999dfe49a62eb7ee (patch) | |
| tree | 1cd2b0ee833c6971b6e51d2d3fee100f387f0478 /Drawing2D/src/Encoding.cs | |
| parent | fd4ca65c552512784f7a077aa34f3e34c0a79122 (diff) | |
wip
Diffstat (limited to 'Drawing2D/src/Encoding.cs')
| -rw-r--r-- | Drawing2D/src/Encoding.cs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Drawing2D/src/Encoding.cs b/Drawing2D/src/Encoding.cs index 8999623d..58cdf601 100644 --- a/Drawing2D/src/Encoding.cs +++ b/Drawing2D/src/Encoding.cs @@ -7,10 +7,10 @@ namespace Drawing2D { public static class Extensions { - public static int ToUtf8 (this ReadOnlySpan<char> source, Span<byte> buff, int tabWidth = 4) { + public static int ToUtf8 (this ReadOnlySpan<char> source, Span<byte> buff, ref int encodedChar, int tabWidth = 4) { int c = 0; int encodedBytes = 0; - int encodedChar = 0; + while (c < source.Length) { if (source[c] < 0xD800) { if (source[c] == '\t') { @@ -44,6 +44,10 @@ namespace Drawing2D } buff[encodedBytes] = 0; return encodedBytes; + } + public static int ToUtf8 (this ReadOnlySpan<char> source, Span<byte> buff, int tabWidth = 4) { + int encodedChar = 0; + return ToUtf8(source,buff,ref encodedChar, tabWidth); } |