Replies: 1 comment 2 replies
|
It feels weird to operate in runes with arbitrary encoding. Shouldn't all of the legacy non-UTF encodings be covered by UCS-2 range? Then they can be efficiently processed in UTF-16 chars. For UTF-8 and UTF-16 processing, |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello.
I’d like to propose making the following
System.Text.Encodingmembers public:DecodeFirstRuneEncoding.Internal.cs#L74-L78EncodeRuneEncoding.Internal.cs#L80-L84TryGetByteCountEncoding.Internal.cs#L100-L117Motivation
These APIs would enable efficient, Unicode scalar value–based text processing over data in arbitrary encodings.
Today, when working with encoded bytes, common workflows often require converting to UTF-16 (
char/string) first, even when the caller only needs scalar-wise inspection or partial validation.This adds avoidable allocation / conversion overhead and makes some incremental scenarios awkward.
Compatibility / behavior note
Currently these base implementation throws
NotImplementedException.Usually this exception means forgotten implementation, and it implies not to be appropriate for formal release.
I believe they should throw
NotSupportedExceptioninsteadly when they get public.All reactions