Zizq.Codec.MessagePack (Zizq v0.6.0)

Copy Markdown View Source

MessagePack codec, built on Msgpax. The default.

Binaries are strings, not bytes

Elixir does not distinguish a UTF-8 string from a byte array (both are binary/0) so Msgpax packs every binary as a MessagePack str, never a bin. That matches the server, which types payloads as JSON values and rejects bin outright, so Msgpax.Bin should be avoided.

The consequence is that a binary which is not valid UTF-8 encodes without complaint locally but is refused by the server:

HTTP 400  invalid MessagePack: string found to be invalid utf8

Encode raw bytes as base64 in a string, exactly as JSON would require.