Quick answer: Construct 3 Binary Data Set From String losing bytes > 0x7F? UTF-8 encodes high bytes as multi-byte sequences — use base64 or set the data via the Set From Hex action.
Saving binary payload as a string then reloading produces corrupted bytes. The intermediate string went through UTF-8 encoding which inflated high bytes.
Strings Aren’t Byte Arrays
Construct 3 strings are UTF-16 in memory and UTF-8 on disk. A byte 0xC3 encoded as UTF-8 round-trips fine; a byte 0x81 alone is invalid UTF-8 and might be replaced by U+FFFD.
Use Base64
BinaryData.SetFromBase64(savedString)
savedString = BinaryData.GetAsBase64()Round-trips arbitrary bytes via printable ASCII. 33% size overhead, zero corruption.
Hex Alternative
SetFromHex / GetAsHex is similar — 100% size overhead but easier to inspect. Pick base64 for size, hex for debuggability.
Verifying
Round-trip a 256-byte buffer of values 0-255 through the string format — every byte matches.
“Binary ↔ string needs base64 or hex. Raw string truncates above ASCII.”
If you’re storing binary in JSON, base64 is the standard — pick it once and don’t mix with hex later.