Skip to content

fix: is_mostly_bin support chinese characters - #7933

Merged
mhils merged 3 commits into
mitmproxy:mainfrom
caiquejjx:better-bin-check
Oct 30, 2025
Merged

mhils merged 3 commits into
mitmproxy:mainfrom
caiquejjx:better-bin-check

Conversation

@caiquejjx

Copy link
Copy Markdown
Contributor

Description

Fixes: #7807
the strutils.is_mostly_bin function was mistakenly classifying chinese charactes as binary data causing a hex editor to be used instead of a text editor

Checklist

  • I have updated tests where applicable.
  • I have added an entry to the CHANGELOG.

@caiquejjx caiquejjx changed the title fix: better is_mostly_bin_check fix: is_mostly_bin support chinese characters Oct 27, 2025
Comment thread mitmproxy/utils/strutils.py Resolved
@caiquejjx
caiquejjx requested a review from mhils October 27, 2025 21:51

@mhils mhils left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you! This was really useful input. I tinkered a bit with your code and ended up with a slightly revised heuristic that's a bit stricter on UTF-8. Would you mind taking a look and letting me know what you think? Thanks!

@caiquejjx

Copy link
Copy Markdown
Contributor Author

@mhils yeah looks good to me, the heuristics look more concise, nice job

@mhils mhils left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for getting this started! 🍰 🙌

@mhils
mhils merged commit 3b3beed into mitmproxy:main Oct 30, 2025
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.

Could not extract BSD name from mount point

2 participants