Fix UnicodeDecodeError when OpenSSL is not found#2181
Merged
HelloZeroNet merged 1 commit intoHelloZeroNet:py3from Sep 2, 2019
Merged
Fix UnicodeDecodeError when OpenSSL is not found#2181HelloZeroNet merged 1 commit intoHelloZeroNet:py3from
HelloZeroNet merged 1 commit intoHelloZeroNet:py3from
Conversation
Owner
|
It would be better to figure out how to decode the result properly. I was unable to reproduce the error as I have english system installed, but I did tried this way: import subprocess
print("Default encoding:")
proc = subprocess.Popen(
"chcp", shell=True, stderr=subprocess.STDOUT,
stdout=subprocess.PIPE
)
print(proc.stdout.read())
cmd = """powershell Write-Host \xe1rv\xedzt\u0171r\u0151"""
for code_page in [852, 65001]:
subprocess.call("chcp %s" % code_page, shell=True)
proc = subprocess.Popen(
cmd, shell=True, stderr=subprocess.STDOUT,
stdout=subprocess.PIPE
)
back = proc.stdout.read()
print("- Running:", cmd)
print("Back:", back)
print("Back.decode(errors='replace'):", back.decode(errors="replace"))Output: Based on this it would be more proper fix add if sys.platform.startswith("win"):
subprocess.call("chcp 65001", shell=True)To beginning of the function or to |
Contributor
Author
|
Ok, that makes sense. It's still worth merging this PR until we come up with a better solution. |
Contributor
Author
|
For the record: this is now replaced with a better fix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2180