-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API proposal: Utf8.IsValid(bytes) #502
Comments
Because the other proposal has been closed as duplicate, please consider changing Please also let me know what else needs to be done for this proposal to move forward. Thank you. |
@neon-sunset, thanks for that suggestion--@GrabYourPitchforks and I were just double-checking the existing API name to make them consistent. We've updated the proposal above to capture that, and we've made the proposal more targeted. We want to look back at this proposal and determine if it should be included in our next round of planning. We already have an implementation of this that is internal on runtime/src/libraries/System.Private.CoreLib/src/System/Text/Unicode/Utf8Utility.cs Lines 25 to 35 in a9f3262
|
Looks good as proposed namespace System.Text.Unicode
{
// existing static type that shipped in Core 3.0
public static class Utf8
{
// proposed new API
public static bool IsValid(ReadOnlySpan<byte> value);
}
} |
See dotnet/corefxlab#2792 (comment) for some further discussion. Many of our UTF-8 utility methods are internal for use only by
Utf8String
orUTF8Encoding
, but per that discussion there are some scenarios where callers might find those utility methods helpful.In particular, we should expose an API which answers "given a
ROS<byte>
, please return abool
telling me if the input was well-formed UTF-8." It could live on the existingSystem.Text.Unicode.Utf8
utility type.The text was updated successfully, but these errors were encountered: