Repository navigation
Mitigate UnicodeDecodeError due to wrong ASCII charset guess for long files - #2360
Merged
Adam Fourney (afourney) merged 6 commits intoAug 31, 2026
Merged
Conversation
Contributor
Author
|
@microsoft-github-policy-service agree |
Member
|
Thanks! Merged! |
This was referenced Sep 2, 2026
Closed
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.
This PR mitigate
UnicodeDecodeErrorissues encountered when a non-ASCII character appears late in the file, namely after the window used to guess the charset.The changes are the following:
IpynbConverter.accepts()from failing when a file cannot be decoded with the guessed charset. I implemented the same solution used in outlook_msg_converterAnother possibility is to force a retry if a
UnicodeDecodeErroris encountered in the converter using the same approach used when the detected charset isNone. But I preferred to not change the current behavior of the converters.markitdown/packages/markitdown/src/markitdown/converters/_plain_text_converter.py
Lines 66 to 69 in 9dc0d65
The PR fixes #2359. It could also address #1505, #1894 and #1949 (for which there are no working reproducers).
Adam Fourney (@afourney) I hope you could have a look at this human-generated contribution ;-)