Azure / Azure/azure-iot-cli-extension
How to send binary data with "az iot device c2d-message"?
Open
- Dominant language
- Python
- Stars
- 88
- Forks
- 78
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 9
Description
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?
```console
$ 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
```
Contributor guide
Assessment
This issue has not been assessed yet.