markitdown icon indicating copy to clipboard operation
markitdown copied to clipboard

UnicodeEncodeError: 'charmap' codec can't encode characters in position 9-13: character maps to <undefined>

Open pr0x1 opened this issue 7 months ago • 2 comments

I tried to convert a docx file to md fil, but i got this error

UnicodeEncodeError: 'charmap' codec can't encode characters in position 9-13: character maps to

pr0x1 avatar Apr 19 '26 18:04 pr0x1

I've submitted a fix for this issue in PR #1856. The fix wraps print() calls in try/except blocks to handle UnicodeEncodeError gracefully on Windows terminals with charmap codec.

unn-Known1 avatar May 03 '26 15:05 unn-Known1

Thank you for reporting this! The CLI output-encoding crash was addressed in #1149, and the fix is included in v0.1.8. I checked the current CLI with GBK, CP950, and CP1252 output encodings.

Please upgrade to markitdown 0.1.8 and use markitdown input.docx -o output.md (substituting your input filename) when saving output: -o writes UTF-8 and preserves characters that a legacy console encoding cannot represent. Redirecting console output with > can still replace unsupported characters.

Closing this as addressed for the reported CLI crash. If it still occurs with the current release, please feel free to reopen with your version, command, full traceback, and a small sample if available.

afourney avatar Sep 30 '26 20:09 afourney