File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -459,6 +459,10 @@ nmcli.set_lang(lang: str) -> None
459459
460460## Change Log
461461
462+ ### 1.2.0
463+
464+ - Added support for encodings other than UTF-8.
465+
462466### 1.1.2
463467
464468- Fixed a problem with environment variables being scraped.
Original file line number Diff line number Diff line change 1+ import locale
12import os
23from subprocess import CalledProcessError , run
34from typing import List , Union
1415CommandParameter = Union [str , List [str ]]
1516
1617
18+ encoding = locale .getpreferredencoding ()
19+
20+
1721class SystemCommandInterface :
1822
1923 def nmcli (self , parameters : CommandParameter ) -> str :
@@ -42,10 +46,10 @@ def nmcli(self, parameters: CommandParameter) -> str:
4246 env = dict (os .environ , ** {'LANG' : self ._lang })
4347 r = self ._run (commands , capture_output = True ,
4448 check = True , env = env )
45- return r .stdout .decode ('utf-8' )
49+ return r .stdout .decode (encoding )
4650 except CalledProcessError as e :
4751 rc = e .returncode
48- stderr = e .stderr .decode ('utf-8' )
52+ stderr = e .stderr .decode (encoding )
4953 if rc == 2 :
5054 raise InvalidUserInputException (
5155 'Invalid user input, wrong nmcli invocation' ) from e
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ def run_tests(self):
1313
1414setup (
1515 name = 'nmcli' ,
16- version = '1.1.2 ' ,
16+ version = '1.2.0 ' ,
1717 author = 'ushiboy' ,
1818 license = 'MIT' ,
1919 license_files = ('LICENSE.txt' ,),
You can’t perform that action at this time.
0 commit comments