-
Notifications
You must be signed in to change notification settings - Fork 24
Description
OS: Debian 8.10
Python 2.7.9
wmic downloaded from here with all patches applied
Repeatable: Always
Problem description:
Apparently, the wmic returns some results with encoding problems when the windows info have some non-Unicode symbols. I tried to find any flag or option within this python wrapper, but apparently, we don't have any. I'm opening this issue for two reasons:
- Ensure that the wrapper does not have any flag or option to work with UTF-8 encoding;
- Leave the suggestion for a possible improvement, since this problem can affect many users.
Steps to repeat:
-
Install the wrapper following the README.md;
-
Create an user 'james' at the windows machine with the full name set to "Jamés Júnior" (or anything similar);
-
Create a python script like below with a query to get users info;
#!/usr/bin/python import wmi_client_wrapper as wmi wmic = wmi.WmiClientWrapper( username="user", password="pass", host="1.1.1.1", delimiter="|" ) output = wmic.query("SELECT * FROM Win32_NetworkLoginProfile") print(output) -
Run it with
python script.py.
Expected Results:
A JSON String with all users infos.
Actual Results:
A JSON with the expected result is actually returned, but that users with non-Unicode characters are returned with strange (and impossible to detect) character encoding. For example, the user james is returned with full name as:
...'AccountExpires': None, 'FullName': 'Jam\xc3\x9as J\xc2\xb7nior'}]
Just for information, in the UTF-8 char table the symbols \xc3\x9a and \xc2\xb7 are, respectively, "Ú" and "·".
Note:
Since I believe that this issue is a wmic issue more than a wrapper issue, I also opened an Stack Overflow thread independent of the python part, but this issue is, besides an question, an improvement suggestion.