axiros / terminal_markdown_viewer

Styled Terminal Markdown Viewer
Other
1.8k stars 105 forks source link

Make it can be run and tested in Windows in non-ASCII environment #103

Closed DingJunyao closed 10 months ago

DingJunyao commented 2 years ago

so that it can be run and tested in Windows

Notes:

I only test it in Windows 11(Chinese Simplified) with PowerShell and cmd in Windows Terminal.

Running in Git Bash or running with pipe in PowerShell will cause encoding problem if using non-ASCII characters, which seems like system reasons.

mdv/markdownviewer.py:284 will return (0, 0) if running by PyCharm in Windows, resulting in printing !! Could not derive your terminal width !! later. If raise error in shutil, it will cause OSError: [WinError 6] The handle is invalid. I found the problem, but cannot solve it so far.