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

Print as text if mostly text #258

Merged
merged 1 commit into from
May 25, 2021
Merged

Print as text if mostly text #258

merged 1 commit into from
May 25, 2021

Conversation

dsnet
Copy link
Collaborator

@dsnet dsnet commented Apr 30, 2021

The previous heuristic of treating strings as binary data
if it contains any invalid UTF-8 was too strict.
Loosen the heuristic to check if most of the characters
are printable text.

Fixes #257

@dsnet
Copy link
Collaborator Author

dsnet commented Apr 30, 2021

\cc @rogpeppe

Copy link
Contributor

@rogpeppe rogpeppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much for doing this so promptly. I have one thought for a possible improvement but otherwise LGTM.

cmp/testdata/diffs Show resolved Hide resolved
cmp/report_slices.go Outdated Show resolved Hide resolved
The previous heuristic of treating strings as binary data
if it contains any invalid UTF-8 was too strict.
Loosen the heuristic to check if most of the characters
are printable text.

Fixes #257
@dsnet dsnet merged commit d103655 into master May 25, 2021
@dsnet dsnet deleted the mostly-text branch May 25, 2021 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

better diffs when most chars are ASCII
3 participants