calmjm / tojota

Functions for interacting with Toyota MyT API
Apache License 2.0
73 stars 15 forks source link

Character en/decoding issue #17

Closed levocky closed 3 years ago

levocky commented 3 years ago

Great project! I had an issue related to character en/decoding for file write/read operations:

__File "tojota.py", line 109, in _writefile f.write(contents) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encodingtable)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u011b' in position 86: character maps to

This issue has been solved (in my case) by adding parameter encoding="utf-8" to function open in line 93 and 108.

calmjm commented 3 years ago

Enforced encoding to be utf-8 in https://github.com/calmjm/tojota/pull/22.