-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Type of issue
Missing information
Description
The documentation simply specifies "Returns: OperationStatus A status code that describes the result of the encoding operation."
This leads to the assumption, after one looks at the available enum values, that the method performs some form of validation, i.e. can return OperationStatus.InvalidData. This is not the case. It always substitutes invalid UTF-8 with Rune.ReplacementChar (U+FFFD) and proceeds with the encoding unperturbed, always returning success unless it runs into the other two failure options of DestinationTooSmall or NeedMoreData (the latter only if param isFinalBlock is false).
There is no mention of this either on the method nor at the class description level: https://learn.microsoft.com/en-us/dotnet/api/system.text.encodings.web.textencoder?view=net-10.0
Only way to find out is when unexpected output is encountered in production / tests or if one closely examines the source code.
Page URL
Content source URL
Document Version Independent Id
fe83a6cc-fcae-66ff-b7a5-154fcfdb6d48
Platform Id
9ea117b6-6558-ee75-e0ca-d7451eac5e22