-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fmt : handle invalid UTF-8 input by replacing malformed sequences #9329
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 3 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
073f7fc
test: add word joiner and cyrillic kha character tests for fmt
mattsu2020 36a01a1
feat: Enhance `fmt` to handle invalid UTF-8 input by replacing malfor…
mattsu2020 2c617d4
chore: add FFFD to spell-checker ignore list in fmt test.
mattsu2020 db77543
refactor(uu/fmt): switch string outputs to byte slices for efficiency
mattsu2020 4445c5a
refactor(fmt): replace Option::map_or(false, f) with is_some_and(f)
mattsu2020 c59f1bc
style(fmt): compact whitespace check in WordSplit iterator to single …
mattsu2020 6a313a4
fix(test_fmt): align invalid UTF-8 handling with GNU-compatible passt…
mattsu2020 fee09e6
Merge branch 'main' into fmt_compatibility
mattsu2020 e36cf9d
Merge branch 'main' into fmt_compatibility
mattsu2020 94efbb4
Merge branch 'main' into fmt_compatibility
mattsu2020 6ee9241
refactor(parasplit): extract scan_word_end method to eliminate code d…
mattsu2020 6348929
feat(fmt): add byte_display_width function for UTF-8 display width ca…
mattsu2020 8ece9f5
Merge branch 'main' into fmt_compatibility
sylvestre d2fa979
Merge branch 'main' into fmt_compatibility
mattsu2020 637bf76
Merge branch 'main' into fmt_compatibility
mattsu2020 2c5b12d
refactor(fmt/parasplit): introduce DecodedCharInfo struct for unified…
mattsu2020 7077d69
refactor(fmt): enhance utf8_char_width with constants and comments fo…
mattsu2020 9182df4
style(fmt): remove extra blank lines in parasplit.rs
mattsu2020 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
Some comments aren't visible on the classic Files Changed page.
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
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.
I think using
from_utf8_lossyis incorrect.If you look at the output of GNU
fmt, you will see that they don't do a lossy conversion:And our output:
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.
fix it