You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
It seems CMD is not using UTF-8 by default. When a command fail (for example when an exec is not found, see #6), and failprint tries to decode the output, it fails.
Expected behavior
The error message is at least properly decoded and printed by failprint.
System (please complete the following information):
failprint version: 0.4.1
Python version: 3.6
OS: Windows
Additional context
The encoding used by the console can be obtained with the command chcp. It prints a sentence in the current locale with, I hope always in this format, the "code page" at the end, something like Page de codes active : 850. This code page can then be used to decode the output. We could do something like this:
try:
_, chcp_output=_run_process(["chcp"])
os_encoding=re.search(r"(\d+)").group(1) # code page does not lose charactersexceptUnicodeDecodeError:
importlocale# locale sometimes lose characters (é -> ,)os_encoding=locale.getpreferredencoding()
try:
stdout=stdout.decode("utf8")
exceptUnicodeDecodeError:
ifnotos_encoding:
raisestdout=stdout.decode(os_encoding)
The text was updated successfully, but these errors were encountered:
Describe the bug
It seems CMD is not using UTF-8 by default. When a command fail (for example when an exec is not found, see #6), and failprint tries to decode the output, it fails.
To Reproduce
Same command as in #6.
Expected behavior
The error message is at least properly decoded and printed by failprint.
System (please complete the following information):
failprint
version: 0.4.1Additional context
The encoding used by the console can be obtained with the command
chcp
. It prints a sentence in the current locale with, I hope always in this format, the "code page" at the end, something likePage de codes active : 850
. This code page can then be used to decode the output. We could do something like this:The text was updated successfully, but these errors were encountered: