tasmota / decode-config

Backup/restore and decode configuration tool for Tasmota
GNU Lesser General Public License v3.0
211 stars 32 forks source link

Invalid continuation character with UTF-8 encoding #73

Closed tsmoneta closed 1 year ago

tsmoneta commented 1 year ago

Describe the bug

Running:

Getting an invalid continuation character error on some devices.

To Reproduce

decode-config.py -d TASMOTADEVICE -p PW --json-indent 3 -o ${t}@v.json -o ${t}@v.dmp --ignore-warnings

Expected behavior

No error, just the backups

Version Information

decode-config.py v13.1.0.1 [5f3b6d4] by Norbert Richter nr@prsolution.eu

Script: decode-config.py Version: 13.1.0.1 [5f3b6d4] Python: 3.11.4 Platform: Linux-6.4.11-200.fc38.x86_64-x86_64-with-glibc2.37 - x86_64 OS: Linux 6.4.11-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 16 17:42:12 UTC 2023 Time: 2023-08-23 16:32:28

Please complete the following information
use decode-config.py -V to retrieve the info


decode-config.py v13.1.0.1 [5f3b6d4] by Norbert Richter nr@prsolution.eu

Script:   decode-config.py
Version:  13.1.0.1 [5f3b6d4]
Python:   3.11.4
Platform: Linux-6.4.11-200.fc38.x86_64-x86_64-with-glibc2.37 - x86_64
OS:       Linux 6.4.11-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 16 17:42:12 UTC 2023
Time:     2023-08-23 16:32:28

System' information of your Tasmota data

Append -g System to your decode-config parameter, e. g. decode-config.py -s myconfig.dmp -g System


{"bootcount": 54, "bootcount_reset_time": 1648075433, "cfg_crc": "0x80b6", "cfg_crc32": "0x6064e4ff", "cfg_holder": 4617, "cfg_size": 4096, "cfg_timestamp": 1692821528, "header": {"data": {"crc": "0x91e8", "crc32": "0x6064e4ff", "hardware": "ESP82", "size": 4096, "version": {"id": "0xd010000", "name": "13.1.0"}}, "env": {"platform": "Linux-6.4.11-200.fc38.x86_64-x86_64-with-glibc2.37", "python": "3.11.4", "script": "decode-config.py v13.1.0.1 [5f3b6d4]", "system": "Linux x86_64 6.4.11-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 16 17:42:12 UTC 2023"}, "template": {"crc": "0x80b6", "crc32": "0x6064e4ff", "size": 4096, "version": {"id": "0xd000002", "name": "13.0.0.2"}}, "timestamp": "2023-08-23 20:12:08"}, "version": "0xd010000"}

Additional context

Changing utf-8 to latin-1 prevents the error.

curzon01 commented 1 year ago

can not reproduce, latin-1 might not be a common solution pls provide the error message provide also if possible (e.g. by mail) a dmp file of a related device

tsmoneta commented 1 year ago

Full error:

Traceback (most recent call last): File "/home/mmoneta/decode-config/decode-config.py", line 6541, in if CONFIG['encode'][0:len(TASM_FILE_SETTINGS)].decode("utf-8") == TASM_FILE_SETTINGS: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9e in position 4: invalid start byte

dmp file sent to norbert.richter@prsolution.eu

curzon01 commented 1 year ago

try latest dev v13.1.0.1 [ec8f0ef]

tsmoneta commented 1 year ago

Confirmed fixed.