You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the latest nodemcu-uploader 0.4.3 (serial 3.2.1) from github, Python 2.7.14.
Trying to upload a Lua file containing UTF-8 characters, the nodemcu-uploader fails
when option --verify is used. Without the --verify the upload succeeds (luckily!).
$ nodemcu-uploader.py --port /dev/cuaU1 upload -v sha1 test.lua
opening port /dev/cuaU1 with 115200 baud
Preparing esp for transfer.
Transferring test.lua as test.lua
Verifying using sha1...
Remote SHA1: 6c872418ff59355d196a1762f52ab53b3079318a
Traceback (most recent call last):
File "nodemcu_uploader/nodemcu-uploader.py", line 11, in <module>
main.main_func()
File "nodemcu_uploader/main.py", line 267, in main_func
args.restart)
File "nodemcu_uploader/main.py", line 56, in operation_upload
uploader.write_file(filename, dst, verify)
File "nodemcu_uploader/uploader.py", line 294, in write_file
self.verify_file(path, destination, verify)
File "nodemcu_uploader/uploader.py", line 316, in verify_file
filehashhex = hashlib.sha1(content.encode(ENCODING)).hexdigest()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 67: ordinal not in range(128)
The python code should be treating the contents of the file to be uploaded as bytes, not trying to attribute a character set to it - and if any at all, it should not be limited to ASCII, but at least to UTF-8. After all, Lua is 8-bit clean as far as strings are concerned, so an uploader should not be posing unnecessary restrictions.
The text was updated successfully, but these errors were encountered:
Using the latest nodemcu-uploader 0.4.3 (serial 3.2.1) from github, Python 2.7.14.
Trying to upload a Lua file containing UTF-8 characters, the nodemcu-uploader fails
when option --verify is used. Without the --verify the upload succeeds (luckily!).
Example file to be uploaded:
The python code should be treating the contents of the file to be uploaded as bytes, not trying to attribute a character set to it - and if any at all, it should not be limited to ASCII, but at least to UTF-8. After all, Lua is 8-bit clean as far as strings are concerned, so an uploader should not be posing unnecessary restrictions.
The text was updated successfully, but these errors were encountered: