Skip to content
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

Fix Encoding.GetChars return value #9087

Merged
merged 1 commit into from
Jun 18, 2023
Merged

Conversation

ltrzesniewski
Copy link
Contributor

Summary

Encoding.GetChars(ReadOnlySpan<Byte>, Span<Char>) returns the number of written chars, not the number of decoded bytes as currently documented.

See the default implementation, which delegates to the GetChars(Byte*, Int32, Char*, Int32) overload.

I used the same text as in Decoder.GetChars(ReadOnlySpan<Byte>, Span<Char>, Boolean).

This method returns the number of returned chars, not the number of decoded bytes.
@ltrzesniewski ltrzesniewski requested a review from a team as a code owner June 18, 2023 16:48
@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Jun 18, 2023
@ghost
Copy link

ghost commented Jun 18, 2023

Tagging subscribers to this area: @dotnet/area-system-text-encoding
See info in area-owners.md if you want to be subscribed.

Issue Details

Summary

Encoding.GetChars(ReadOnlySpan<Byte>, Span<Char>) returns the number of written chars, not the number of decoded bytes as currently documented.

See the default implementation, which delegates to the GetChars(Byte*, Int32, Char*, Int32) overload.

I used the same text as in Decoder.GetChars(ReadOnlySpan<Byte>, Span<Char>, Boolean).

Author: ltrzesniewski
Assignees: -
Labels:

area-System.Text.Encoding, community-contribution

Milestone: -

@tarekgh tarekgh enabled auto-merge June 18, 2023 17:21
@learn-build-service-prod
Copy link

Learn Build status updates of commit d5bda76:

✅ Validation status: passed

File Status Preview URL Details
xml/System.Text/Encoding.xml ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@tarekgh tarekgh merged commit 05036c1 into dotnet:main Jun 18, 2023
2 checks passed
@ltrzesniewski ltrzesniewski deleted the patch-1 branch June 18, 2023 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Text.Encoding community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants