I could be wrong, but I think to_string is not equivalent to IO.iodata_to_binary. to_string expects a list of codepoints, but IO.iodata_to_binary expects any integers in the list to be bytes:
iex(2)> "hełło" |> String.to_charlist |> IO.iodata_to_binary
** (ArgumentError) argument error
:erlang.iolist_to_binary([104, 101, 322, 322, 111])
iex(2)> "hełło" |> String.to_charlist |> to_string
"hełło"
I don’t know if this makes any difference if what you start with is an iolist though.


















