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
It seems like the issue is related to the encoding of the binary data. When you pass bytearray(b'\xa0') to send_raw, it's treating it as a Unicode string and encoding it with the default encoding (which is usually UTF-8). In UTF-8, the byte 0xa0 is not a valid standalone character and gets encoded as the two-byte sequence 0xc2 0xa0.
To avoid this issue, you can encode the binary data as base64 before sending it using send_raw. Here's an example of how you can do it:
`import base64
On the receiving end, you'll need to decode the base64-encoded data to get back the original binary data. Here's an example of how you can do it:
`import base64
received_data = receive_raw('HW_INT')
decoded_data = base64.b64decode(received_data)
`
This should give you the original binary data without any encoding issues.
Im trying to send the following binary blob via send_raw.
However my 0xa0 is becoming 0xc2 0xa0. Do i need to convert the byte array to a string via some sort of encoding prior to sending.
However on the receiving end I am seeing 2 bytes
Some other characters are causing my problems also.
Unsure how to properly encode/decode a string for this.
The cosmos console only shows this, but im unsure if its taking the length of a unicode object or a byte array.
The text was updated successfully, but these errors were encountered: