xenserver / xscontainer

Support for Docker and Container Management
BSD 2-Clause "Simplified" License
25 stars 14 forks source link

Update util/__init__.py #59

Closed dalrrard closed 2 years ago

dalrrard commented 2 years ago

Modified convert_dict_to_ascii(item) to convert to utf-8 instead. Some docker containers have values that are outside of the ascii range which causes xscontainer to crash with a UnicodeEncodeError. If ascii is absolutely necessary, line 154 could be changed to item.encode('ascii', 'replace') instead. I've tested the change to utf-8 on my system with no ill effects.

If this is changed to utf-8, the function name and references should probably be updated to convert_dict_to_utf8 as well. Didn't want to get ahead of myself in case this is a show stopper.

liulinC commented 2 years ago

The change itself looks good to me