-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib] Rewrite UTF8 decoding #1525
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
49741cf
[stdlib] Rewrite UTF8 decoding
PatrickPijnappel 25b5028
[stdlib] Improve UTF8._decodeOne() doc comment
PatrickPijnappel f5d7bd2
[stdlib] Improve comments in UTF8
PatrickPijnappel 17124c8
[stdlib] Clarify variable name in UTF8
PatrickPijnappel 500dc9d
[stdlib] Fix bitshift operand mask in UTF8.decode()
PatrickPijnappel c109bb2
[stdlib] Copy warning to docs of all UnicodeCodecTypes
PatrickPijnappel 636423c
[stdlib] Minor refactor for clarity in UTF8.decode()
PatrickPijnappel 4d05dc6
[stdlib] Resolve merge conflict in Unicode.swift
PatrickPijnappel 2ec5710
[stdlib] Format and clarify documentation in Unicode.swift
PatrickPijnappel 549f7e2
[stdlib] Fix incorrect merge 4d05dc69
PatrickPijnappel 43bca07
[stdlib] Fix doc comment for UnicodeScalar.encode()
PatrickPijnappel 4d3d723
[stdlib] Replace usages of generator with iterator
PatrickPijnappel 7e0945e
[stdlib] Use explicit internal in Unicode.swift
PatrickPijnappel 771a815
[stdlib] Fix indentation in Unicode.swift
PatrickPijnappel ffe8646
[stdlib] Clarify buffer comments in UTF8._decodeOne()
PatrickPijnappel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PatrickPijnappel
Just out of curiosity, why
return !UTF8.isContinuation(UTF8.CodeUnit(truncatingBitPattern: _buffer))
is insufficient?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rintaro That would change the behavior slightly w.r.t. the original version, as not all non-continuation code units are valid starting code units (e.g.
0xff
). Though the difference is somewhat inconsequential as_buffer
should be well-formed, and in general it's not clear from the documentation what the handling of mal-formed sequences should be.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying :)