Skip to content

Fix decode error on non-utf8 environments #60

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pylsp_mypy/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ def get_diagnostics(
global tmpFile
if live_mode and not is_saved:
if tmpFile:
tmpFile = open(tmpFile.name, "w")
tmpFile = open(tmpFile.name, "w", encoding="utf-8")
else:
tmpFile = tempfile.NamedTemporaryFile("w", delete=False)
tmpFile = tempfile.NamedTemporaryFile("w", delete=False, encoding="utf-8")
log.info("live_mode tmpFile = %s", tmpFile.name)
tmpFile.write(document.source)
tmpFile.close()
Expand Down