Is there a way to discover which character encodin...
# kotlin-native
n
Is there a way to discover which character encoding is used? Some of the MQTT payloads have gibberish in them. Below is some sample output from the official Test Mosquitto server (a MQTT Broker), which is accessed from a Linux X64 PC:
Copy code
Message arrived.
Topic Length: 0).
Topic: some/test/ships
Payload: {"lat":50.895,"lon":-1.391,"name":"ANGRY WASP","type":"sailing","typeno":36,"icon":"ship","iconColor":"lightblue","bearing":"300","speed":"0.0","destination":"","callsign":"MCMK9","layer":"AIS","time":"2019-07-04 02:16:34 UTC","ts":1562206594}

Message arrived.
Topic Length: 0).
Topic: /golot7/kitchen/center/lampstatus
Payload: 0

Message arrived.
Topic Length: 0).
Topic: analytics
Payload: {"name":"event.system.incoming.communication","date":1562206718325,"content":{"system.id":"08afb391512349019fc4462c69903138","communication.id":"45454545","message.id":"5b40f35036ad4a88afab6110b982a8d2","threadId":"18"}}2043����

Message arrived.
Topic Length: 0).
Topic: /merakimv/Q2EV-2QFS-YRYE/light
Payload: {"lux": 109.8}

Message arrived.
Topic Length: 0).
Topic: analytics
Payload: {"name":"event.system.incoming.communication","date":1562206718379,"content":{"system.id":"08afb391512349019fc4462c69903138","communication.id":"45454545","message.id":"77c19ab137e04c61b15f3cff2b816510","threadId":"7"}}":"20����A

Message arrived.
Topic Length: 0).
Topic: rpi/rpi
Payload: �?�3�A��s
                     |�
g
It’s pretty complicated task to detect encoding (essentially try many of them and try to find some meaningful content in result). Also what I see looks like broken encoding (encoding changed more than once, so it may be impossible to restore)