Skip to content

Commit e45f070

Browse files
authored
Merge pull request #65 from ushiboy/release/1.2.0
[WIP] Release 1.2.0
2 parents 78e077d + a715591 commit e45f070

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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.

nmcli/_system.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import locale
12
import os
23
from subprocess import CalledProcessError, run
34
from typing import List, Union
@@ -14,6 +15,9 @@
1415
CommandParameter = Union[str, List[str]]
1516

1617

18+
encoding = locale.getpreferredencoding()
19+
20+
1721
class 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

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def run_tests(self):
1313

1414
setup(
1515
name='nmcli',
16-
version='1.1.2',
16+
version='1.2.0',
1717
author='ushiboy',
1818
license='MIT',
1919
license_files = ('LICENSE.txt',),

0 commit comments

Comments
 (0)