msgpack-erlang icon indicating copy to clipboard operation
msgpack-erlang copied to clipboard

Force pack as binary

Open adrianroe opened this issue 4 years ago • 1 comments

I'm trying to pack the following data structure.

#{<<"Coalesce">> => true,
  <<"Name">> => <<"streamAvailable">>,
  <<"Payload">> =>
      term_to_binary({streamAvailable,{streamId,<<"stream1">>},<<"172.16.169.1">>})
}.

In a perfect world I would use '{pack_str, from_binary}' but it then tries to pack Payload as a string and fails on the 'unicode:characters_to_binary' check. Is there a way to force Payload to be encoded as a binary while allowing the others to remain strings?

Thanks for the efforts on a great library!

adrianroe avatar Dec 03 '19 19:12 adrianroe

@adrianroe Hi, did you resolve this issue?

iAchilles avatar Nov 15 '23 21:11 iAchilles