How To Convert An Elixir Binary To A String?

前端 未结 6 1558
天命终不由人
天命终不由人 2020-12-10 02:41

So I\'m trying to convert a binary to a string. This code:

t = [{<<71,0,69,0,84,0>>}]
String.from_char_list(t)

But I\'m gettin

6条回答
  •  一生所求
    2020-12-10 03:19

    The last point definitely does change the issue, and explains it. Elixir uses binaries as strings but assumes and demands that they are UTF8 encoded, not UTF16.

提交回复
热议问题