-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
od: fix handling of non-ascii chars #8268
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
Conversation
50ecff0
to
94feb2d
Compare
GNU testsuite comparison:
|
I'm not familiar with |
I'd say the difference could come from different encodings, eg:
|
And also:
|
Unless I'm mistaken, in this example, it's the input given to |
I think this fix is good though, I'll happily merge it once the typo is addressed ^^' |
Ah, yes, you're correct.
Sorry for the confusion, which typo? :) |
C.f. my comment #8268 (comment) |
src/uu/od/src/prn_char.rs
Outdated
@@ -51,33 +50,13 @@ fn format_item_c(bytes: &[u8]) -> String { | |||
let b = bytes[0]; | |||
|
|||
if b & 0x80 == 0x00 { | |||
// // ASCII byte (0xxxxxxx) |
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.
// // ASCII byte (0xxxxxxx) | |
// ASCII byte (0xxxxxxx) |
That's absolutely my bad, I didn't see this was still pending |
No worries! And thank you for the review! Fixed the typo, rebased on the latest |
GNU testsuite comparison:
|
Thank you for your contribution ! 🚀 |
Fixes #8202
I'm not sure if this fix is complete, because I couldn't reproduce the original behavior of uutils impl with GNU od, so I don't know in which situations the previous implementation was valid (I assume there is/was a reason for implementing it the way it was implemented).
Regardless of the above, this fixes the reported issue. It still lacks localization support, but it works correctly for
LC_ALL=C
as well asLC_ALL=en_US.UTF-8
.