Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Encoding error

Hello,

I’ve been attempting to achieve some MQTT comms between an ESP32 and a python interface. If I transmit a const char from the ESP32, the on_message class in the client_sub example can print the payload with ease. If I transmit a uint8_t* from the ESP and attempt to decode this data on the python end I receive an error ‘UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf2 in position x: unexpected end of data’. If I print the data without attempting to decode it looks like this ‘b'N\xef\xfa\x00\x7f\xf6\x00p\x00\x00\xe0\x00\x00\x9f\xf2\x00\xff\xfa\x00\xb0\x00\x00\xa0\x00\x00\xaf\xfa\x00\x7f\xfe\x00\xae\xccp\x00\x00`\’ , so understandably cannot be decoded as utf-8. Is the data being corrupted during the publish or am I missing something on the decode end?

Any assistance with this would be greatly appreciated.

Best wishes,

Henry Cowan


Back to the top