joeyespo / grip

Preview GitHub README.md files locally before committing them.
MIT License
6.42k stars 423 forks source link

UnicodeEncodeError when exporting to stdout in Git Bash #336

Open glibg10b opened 3 years ago

glibg10b commented 3 years ago

I'm using the MINGW64 terminal.

$ grip test --export -

Traceback (most recent call last):
  File "D:\Program Files\Python\Python39\Scripts\grip-script.py", line 33, in <module>
    sys.exit(load_entry_point('grip==4.5.2', 'console_scripts', 'grip')())
  File "d:\program files\python\python39\lib\site-packages\grip\command.py", line 107, in main
    export(args['<path>'], args['--user-content'], args['--context'],
  File "d:\program files\python\python39\lib\site-packages\grip\api.py", line 122, in export
    print(page)
  File "d:\program files\python\python39\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 983914-983915: character maps to <undefined>

Exporting to a file works fine:

$ grip test --export test2

Exporting to test2