markdown-crawler icon indicating copy to clipboard operation
markdown-crawler copied to clipboard

UnicodeEncodeError : 'charmap' codec can't encode characters in position 2473-2474: character maps to

Open jeaneigsi opened this issue 9 months ago • 1 comments

The error occurs in the crawl function in the init.py file, specifically in the section where markdown content is written to a file. Here is the relevant code excerpt:

# line 140 
with open(file_path, 'w') as f:
    f.write(output)

To resolve this issue, I suggest specifying the encoding when opening the file for writing. Here is the corrected code:

with open(file_path, 'w', encoding='utf-8') as f:
    f.write(output)

By adding encoding='utf-8' to the open() function, Python will use UTF-8 encoding when writing the file, which should prevent the UnicodeEncodeError.

jeaneigsi avatar May 06 '24 08:05 jeaneigsi

nice bro, same problem :)))

pvbang avatar Jun 08 '24 09:06 pvbang