-
Notifications
You must be signed in to change notification settings - Fork 55
Fix stdin encoding #515
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
Fix stdin encoding #515
Conversation
|
@hukkin oh. I just executed the command itself - I will fix the test. |
|
I fixed the tests using stdin. Locally, tests using symlinking are failing for me, but that's due to Windows, I guess. |
|
Thanks for this! flake8 complains: Would you able to fix this? Edit: All good actually. Seems I was able to commit the fix to your branch myself. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #515 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 15 15
Lines 970 970
Branches 171 171
=========================================
Hits 970 970 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
for more information, see https://pre-commit.ci
|
@hukkin Sorry for the late reply. I did not have access to my computer for a couple of days. Thanks a lot for fixing the last issues and merging! |
Change: Use utf8-encoding when reading files from stdin.
The current code uses stdout.buffer.read() + encode for writing, which implies Utf8 encoding, but uses stdin.read(), which uses an environment specific encoding. See docs.
I ran into this issue when using Mdformat with Helix on Windows. For files with German content and Utf8-encoding the current code mangled any non-ascii characters. The proposed code fixed this behavior.