Convert config file from unicode to string before writing, if necessary.

This commit is contained in:
James 2019-02-15 20:46:52 -06:00
parent 733b27a496
commit 31c8afcb9e
1 changed files with 4 additions and 0 deletions

View File

@ -92,6 +92,10 @@ class KlipperPlugin(
filepath = os.path.expanduser(
self._settings.get(["configuration", "path"])
)
# Check for Unicode config file and convert to String, if so.
if type(data["config"]) == unicode:
data["config"] = data["config"].encode('utf-8')
f = open(filepath, "w")
f.write(data["config"])
f.close()