diff --git a/lib/json5/decode/backend/yecc.ex b/lib/json5/decode/backend/yecc.ex index 2e98aab..603c9aa 100644 --- a/lib/json5/decode/backend/yecc.ex +++ b/lib/json5/decode/backend/yecc.ex @@ -25,7 +25,7 @@ defmodule Json5.Decode.Backend.Yecc do charlist |> :string.replace([92, 13, 10], []) |> :string.replace([92, 10], []) - |> :erlang.iolist_to_binary() + |> :unicode.characters_to_binary() end defp to_term({:key, _, charlist}, config) do diff --git a/test/json5/decode_test.exs b/test/json5/decode_test.exs index 3635757..6b4a57d 100644 --- a/test/json5/decode_test.exs +++ b/test/json5/decode_test.exs @@ -18,6 +18,7 @@ defmodule Json5.DecodeTest do [:boolean, true, "true"], ["string single quote", "some text", "'some text'"], ["string double quote", "some text", "\"some text\""], + ["string unicode", "ūňĭčŏďē text", "\"ūňĭčŏďē text\""], ["number hex", decimal(2801), "0xaf1"], ["number hex", decimal(120_772), "0X1D7c4"], [:number, decimal(2801), "2801"],