eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.61k stars 2.33k forks source link

Any help, advice appreciated (Unicode / UTF-8)?? #3032

Closed GerritS76 closed 2 months ago

GerritS76 commented 2 months ago

I am using Mosquitto 2.0.18 with Meshtastic, nothing wrong with that. But as soon as I send ceretain words or sentences strange things happen. Between Mosquitto and Meshtastic devices messages are sent in text (UTF-8).

The following occurs. When sending UTF-8 like text, it shows \u0000 instead of certain letters. Some example words:

Geïsoleerd (isolated) with a " on top of the i. No matter how I send it to Mosquitto, it's always shown as \u0000. Same happens when using other letters like éäóö etc... (looks like UTF-8 is all converted into Unicode(?)).

An example: mosquitto_pub -h localhost -u {user} -P {pass} -t 'msh/3300-3329/2/json/mqtt/!{hidden}' -m '{"channel": 0,"from":3663497172,"type":"sendtext","payload":"Weer even één testje..."}'

Shows:

{"channel":0,"from":{hidden},"hops_away":0,"id":1749253767,"payload":{"text":"Weer even \u0000\u0000\u0000\u0000n testje..."},"sender":"{hidden}","timestamp":1712426348,"to":{hidden},"type":"text"}

Both via MQTT Explorer as well when using mosquitto_sub or all sorts of other methods like Python PIP modules, PHP (pear) modules etc. As i am out of idea's i wonder if there's a way to get \u0000 converted into normal UTF-8 output?

It sent the correct way to Mosquitto (MQTT), the mqtt/!{hidden} contains the payload without \u0000 but it looks like Mosquitto converts UTF-8 into Unicode.

Does anyone know how to get this resolved so characters are shown the correct way?