How mqtt messages are being converted before transmitted to subscriber

Hi guys ,
i want to know how the messages are being converted before transmission .
for example :

  1. if i transmit the character ‘A’ using MQTTBOX then i receive the character ‘A’ as message and in the raw payload we get 65 — which we know 65 is the ASCI value for ‘A’ . this is understandable

  2. but if i transmit any non english character like न then i receive the same न as message and in the raw payload we get “224164168” ----- so my doubt is how MQTT is converting this न as “224164168” which im not able to understand

by the way the unicode value for न is U+0928

so does anyone know how the value “224164168” is converted back to न

I’m using MQTT v3.1.1

Hello @shanmukha ,

Thank you for the outreach, and the interest in MQTT!

Messages prior to transmission are handled as binary data, as per OASIS specification. Some additional details about message payloads and message formatting can be found in our MQTT Essentials series, here.

Some additional specifics regarding encoding for other message components can be seen on the OASIS specification page for MQTT - here is a link to the MQTT5 page.

Aaron from the HiveMQ Team

hi @AaronTLFranz

Thank you for the reply ,

The links you provided are for MQTT 5 version , but I’m using MQTT version 3.1.1
I read the OASIS specification for the MQTT v 3.1.1 but all i could find there was format of the control bits and variable header format . I couldnt find any encoding standard for the actually payload that user enters and how it is being encoded before transmission and decoding after receiption . I understood that it will send binary data as transmission but from which data type is being converted to binary , is it from decimal - binary or hexadecimal - binary or octal - binary .

In my application i need to send local language characters as payload and using MQTTBOX im able to send the local non english characters and receive the exact at the subscriber . when i receive the same using controller i get the raw payload , so i need to know how that raw payload is being generated in order to decode that at my controller so that using controller also i can able to display the non english local characters

Best Regards

Hello @shanmukha ,

The message data sent via MQTT is entirely data-agnostic - the payload itself is not mutated during message transmission, though some client implementations do have specific formatting options available to them that can impact how the message is received to a subscribing client. Mosquitto, for example, has an ‘output format’ option that can be used to configure how message data is handled once received as a subscriber.

MQTTBox also looks to have specific payload configuration options, defined by this client implementation. This documentation can be found here : Payload Formatters | The Things Stack for LoRaWAN

Essentially, any data can be encoded as-preferred and sent as an MQTT message, and then decoded upon receipt based on configuration requirements, as the message protocol will not mutate the original message from its binary form.

Aaron from the HiveMQ Team