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 11import subprocess
22from typing import NamedTuple
33
4+ import chardet
5+
46
57class Command (NamedTuple ):
68 out : str
@@ -21,8 +23,8 @@ def run(cmd: str) -> Command:
2123 stdout , stderr = process .communicate ()
2224 return_code = process .returncode
2325 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" ] ),
2628 stdout ,
2729 stderr ,
2830 return_code ,
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ jinja2 = ">=2.10.3"
5656pyyaml = " >=3.08"
5757argcomplete = " ^1.12.1"
5858typing-extensions = " ^4.0.1"
59+ chardet = " ^5.0.0"
5960
6061[tool .poetry .dev-dependencies ]
6162ipython = " ^7.2"
You can’t perform that action at this time.
0 commit comments