Fix null-separated ASCII misdetected as UTF-16-BE#347
Merged
dan-blanchard merged 12 commits intomainfrom Mar 17, 2026
Merged
Conversation
Addresses #346 — ASCII text with null byte separators (common in Unix CLI output) being misdetected as utf-16-be. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Clarify UTF-16 guard applies in both single/dual candidate paths - Note mypyc compilation constraint for utf1632.py - Detail ASCII implementation using existing _ALLOWED_ASCII table - Clarify pipeline reorder: computation order vs return order - Note UniversalDetector propagation - Fix language=None vs "" discrepancy in test expectations Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6-task TDD plan covering UTF-16 guard, null-tolerant ASCII detection, and pipeline reorder. Addresses #346. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ication (#346) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Spec and plan are preserved in git history but don't need to be in the final merge diff. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Real-world null-separator data (find -print0, git ls-tree -z) is 1-3.5% nulls. 5% covers all realistic cases while staying well below the UTF-16 guard threshold (15%). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #347 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 23 23
Lines 1436 1449 +13
=========================================
+ Hits 1436 1449 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Replace Python-level all() loop with C-level bytes.translate(), matching the pattern used in binary.py and ascii.py. Cross-references the shared ASCII byte set with ascii.py's _ALLOWED_ASCII. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract ASCII_TEXT_BYTES to pipeline/__init__.py and use it in both ascii.py and utf1632.py to prevent drift between the two definitions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Excellent, thank you! |
Member
Author
|
Happy to help! 7.2.0 is out now with the fix |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
find -print0,git ls-tree -z) being misdetected asutf-16-bewith confidence 0.95Fixes #346
Test plan
utf-16-be#346 returnsasciiat 0.99find -print0style output returnsasciiat 0.99🤖 Generated with Claude Code