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 '\u2009' in position 390: illegal multibyte sequence #227

Open
ZhuPingFei opened this issue Dec 28, 2024 · 4 comments

Comments

@ZhuPingFei
Copy link

UnicodeEncodeError: 'gbk' codec can't encode character '\u2009' in position 390: illegal multibyte sequence

@codeicu
Copy link

codeicu commented Dec 31, 2024

same issue

@SEU-zxj
Copy link

SEU-zxj commented Dec 31, 2024

It seems that Issue #198 has solved this problem.
If you still encouner this problem, below is my solution:

  1. Write a .py file (let's say it is converter.py)
from markitdown import MarkItDown

md = MarkItDown()
result = md.convert("your-file-name")
print(result.text_content)
  1. move the output text into a markdown file.
$ python convertor.py > your-file-name.md

That's worked for me.

@SEU-zxj
Copy link

SEU-zxj commented Dec 31, 2024

If above code do not work, you can try below:

from markitdown import MarkItDown

md = MarkItDown()
result = md.convert("your-file-name.pptx")
text = result.text_content
    
# Save to a file
with open("your-file-name.md", "w", encoding="utf-8") as f:
    f.write(text)

# Print to the console
# print(text)

@codeicu
Copy link

codeicu commented Dec 31, 2024

This works for me:

markitdown < 1.pdf

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