-
Notifications
You must be signed in to change notification settings - Fork 496
Description
What did I do
I try to read binary data from a channel and save it with "--file-write".
./mqttx-cli-macos-x64 sub -h 192.168.xxx.xxx --format binary --output-mode clean --file-write ew10.netp -t home/ew10/state >ew10.json
What happened
The output in "ew10.netp" contains extraneous bytes and doesn't match the clean output in "ew10.json", which has the correct data:
$ hexdump -C ew10.netp | head -3
00000000 1b 77 00 00 00 04 ef bf bd 01 01 07 0a 1b 78 00 |.w............x.|
00000010 00 00 05 ef bf bd 03 02 00 68 0a 1b 79 00 00 00 |.........h..y...|
00000020 04 ef bf bd 01 01 07 0a 1b 7a 00 00 00 0f ef bf |.........z......|
head -40 ew10.json
{
"topic": "home/ew10/state",
"payload": {
"type": "Buffer",
"data": [
43,
84,
0,
0,
0,
4,
247,
1,
1,
7
]
},
"packet": {
"cmd": "publish",
"retain": false,
"qos": 0,
"dup": false,
"length": 28,
"topic": "home/ew10/state",
"payload": {
"type": "Buffer",
"data": [
43,
84,
0,
0,
0,
4,
247,
1,
1,
7
]
}
}
Expected
It is expected that the binary output has the bytes that can be found in the clean output.
Environment
- OS: OS version, e.g. macOS Big Sur 11.1
- MQTTX version, e.g. v1.5.0
More detail
It seems to me that there is a conversion going on and somehow the binary data is interpreted as UTF-8, which fails. Any non-UTF-8-compliant byte sequences would be replaced with ef bf bd
. This sequence can be found multiple times in the output.
Other "ASCII compatible" byte sequences like "00 00 00 04" or "01 01 07" can be found in the output.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status