File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 1
1
import subprocess
2
2
from typing import NamedTuple
3
3
4
+ import chardet
5
+
4
6
5
7
class Command (NamedTuple ):
6
8
out : str
@@ -21,8 +23,8 @@ def run(cmd: str) -> Command:
21
23
stdout , stderr = process .communicate ()
22
24
return_code = process .returncode
23
25
return Command (
24
- stdout .decode ("iso-8859-1" ),
25
- stderr .decode ("iso-8859-1" ),
26
+ stdout .decode (chardet . detect ( stdout )[ "encoding" ] ),
27
+ stderr .decode (chardet . detect ( stderr )[ "encoding" ] ),
26
28
stdout ,
27
29
stderr ,
28
30
return_code ,
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ jinja2 = ">=2.10.3"
56
56
pyyaml = " >=3.08"
57
57
argcomplete = " ^1.12.1"
58
58
typing-extensions = " ^4.0.1"
59
+ chardet = " ^5.0.0"
59
60
60
61
[tool .poetry .dev-dependencies ]
61
62
ipython = " ^7.2"
You can’t perform that action at this time.
0 commit comments