I’m performing an :erlang.binary_to_term encoding (the term is {:entitlements, 1396429}). As a result, this comes out to be <<131, 104, 2, 100, 0, 12, 101, 110, 116, 105, 116, 108, 101, 109, 101, 110, 116, 115, 98, 0, 21, 78, 205>>.
If I put this into something like redis, it is encoded to look like (what I think is) an ASCII string: "\x83h\x02d\x00\x0centitlementsb\x00\x15N\xcd". I can get something similar by using IO.inspect(binaries: :as_strings). But it’s not exactly the same as what redis has. IO inspect returns: "\x83h\x02d\0\fentitlementsb\0\x15N\xCD".
One difference, is the \f vs redis having \x0c. These are both <<12>>. If you start iex and put in <<12>> it returns \f. And ?\f is 12, and 0x0c is also 12.
So, I guess my questions:
- How does elixir pick which format
\fvs\x0cto print out? - How can I pick which format to use, if at all?
- For bonus points: How do I get the value that
IO.inspectprints without sending it tostdio?
Any information is help, thank you!






















