You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The payload of a MQTT message is binary (it can't be assumed to be ASCII or UTF-8). Unfortunately Ruby does not have an 'array of bytes' class like other languages do - for example node.js has Buffer. So at the moment, just create a string without specifying a type for it.
I did have a plan to add payload type conversion (see #60) - so maybe passing in :utf8 as the type could be a solution. Or maybe it is better to assume the buffer is utf8 in the first place is a better default.
When I run
this, I get
ASCII-8BIT
. And subsequent string uses may fail with non-ASCII strings.My code works when I do
message = message.force_encoding('utf-8')
. But this is not optimal.The text was updated successfully, but these errors were encountered: