Skip to content

How to send binary data with "az iot device c2d-message"? #287

Description

@hitochan777

Can I send binary data with az iot device c2d-message, that is represented with HEX like 0x86 0x54 0x32?
I converted a string to another with backslash escapes interpreted and then feed it to az iot device c2d-message command.
But I got UnicodeEncodeError as shown below. Will it work if I specify proper content encoding?

$ CMD = "\x86\x54\x32"
$ OUTPUT="$(echo -e $CMD)"
$ az iot device c2d-message send --device-id $DEVICE_ID -n $NAME --data $OUTPUT
...
UnicodeEncodeError: 'utf-8' codec can't encode character '\udc86' in position 0: surrogates not allowed

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions