Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeEncodeError: 'gbk' codec can't encode character '\u2022' in position 10470: illegal multibyte sequence #285

Open
highyield3011 opened this issue Jan 15, 2025 · 3 comments

Comments

@highyield3011
Copy link

(Microsoft-MarkItDown) C:\Users\zaish01317\MarkItDown>markitdown "C:\Users\zaish01317\translation-agent\examples\sample-texts\Modular RAG Transforming RAG Systems into LEGO-like Reconfigurable Frameworks.pdf"

"C:\Users\zaish01317\translation-agent\examples\sample-texts\Modular RAG Transforming RAG Systems into LEGO-like Reconfigurable Frameworks.pdf.md"
Traceback (most recent call last):
File "C:\Users\zaish01317.conda\envs\Microsoft-MarkItDown\lib\runpy.py", line 196, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\Users\zaish01317.conda\envs\Microsoft-MarkItDown\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\zaish01317.conda\envs\Microsoft-MarkItDown\Scripts\markitdown.exe_main
.py", line 7, in
File "C:\Users\zaish01317.conda\envs\Microsoft-MarkItDown\lib\site-packages\markitdown_main
.py", line 43, in main
print(result.text_content)
UnicodeEncodeError: 'gbk' codec can't encode character '\u2022' in position 10470: illegal multibyte sequence

(Microsoft-MarkItDown) C:\Users\zaish01317\MarkItDown>markitdown ModularRAG.pdf > ModularRAG.pdf.md
Traceback (most recent call last):
File "C:\Users\zaish01317.conda\envs\Microsoft-MarkItDown\lib\runpy.py", line 196, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\Users\zaish01317.conda\envs\Microsoft-MarkItDown\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\zaish01317.conda\envs\Microsoft-MarkItDown\Scripts\markitdown.exe_main
.py", line 7, in
File "C:\Users\zaish01317.conda\envs\Microsoft-MarkItDown\lib\site-packages\markitdown_main
.py", line 43, in main
print(result.text_content)
UnicodeEncodeError: 'gbk' codec can't encode character '\u2022' in position 10470: illegal multibyte sequence

ModularRAG.pdf

@HArars
Copy link

HArars commented Jan 15, 2025

markitdown = MarkItDown()
result = markitdown.convert(read_filename)
with open('write_filename.md', 'w', encoding='gbk', errors='ignore') as f:
    f.write(result.text_content)

@highyield3011
Copy link
Author

Thank you @HArars

@kristofmulier
Copy link

This works too:

>chcp 65001
Active code page: 65001

>set PYTHONIOENCODING=utf-8

>markitdown my_document.pdf > my_document.md

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

No branches or pull requests

3 participants