Skip to content

Fix UnicodeEncodeError on stdout redirection and update test suite for windows compatibility#2175

Open
Samakinola1 wants to merge 1 commit into
microsoft:mainfrom
Samakinola1:fix-unicode-stdout-encoding
Open

Fix UnicodeEncodeError on stdout redirection and update test suite for windows compatibility#2175
Samakinola1 wants to merge 1 commit into
microsoft:mainfrom
Samakinola1:fix-unicode-stdout-encoding

Conversation

@Samakinola1

Copy link
Copy Markdown

This PR addresses a UnicodeEncodeError that occurs on Windows systems (e.g., within MINGW64, Command Prompt, or PowerShell) when redirecting the output of the markitdown CLI command to a file (e.g., markitdown file.pdf > document.md).

The error arises because the output stream's (sys.stdout.encoding) default is typically set to cp1252 on Windows systems. When markitdown processes documents containing characters outside this charset range (e.g., bullet points like ● / \u25cf), printing directly to stdout raises a UnicodeEncodeError and crashes the utility.

@Samakinola1

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

1 participant