peterhinch / micropython-mqtt

A 'resilient' asynchronous MQTT driver. Recovers from WiFi and broker outages.
MIT License
549 stars 116 forks source link

Unicode letter in MQTT topic or message e.g. "°" lets crash publish() #66

Closed Gert-Lumpy closed 2 years ago

Gert-Lumpy commented 2 years ago

This is reproducible output when having UTF letter in topic or msg: WiFi not connected Checking WiFi integrity. Got reliable connection with IP 192.168.1.4 Connecting to broker. Connected to broker. Wifi is up publish topic + msg ['test/powersensor/temperature/°$unit', '°C'] Wifi is down Connection error WiFi not connected Checking WiFi integrity.

In source code I could see that the length is derived from msg before sending. May be the issue.

peterhinch commented 2 years ago

Messages should be bytes objects or strings comprising the first 128 Unicode code points (i.e. single byte characters).