Parsing array of numbers producing incorrect result
dmccrevan opened this issue · 1 comments
dmccrevan commented
When I am trying to parse a piece of TOML like x = [48, 50, 52]
, this is producing a result I did not expect.
Below is the error occuring in IEX:
iex(23)> Toml.decode("x = [48, 50, 52]")
{:ok, %{"x" => '024'}}
It seems to be producing a number that is the concatenation of the differences between the numbers. Another example is provided below:
iex(24)> Toml.decode("x = [48, 51, 52]")
{:ok, %{"x" => '034'}}
I believe this is an error, but I may be completely wrong and this is just how TOML is supposed to be parsed. Hopefully, this is helpful. If it is an error, I would be more than happy to assist in fixing it.
loguntsov commented
@dmccrevan
Actually everything is right.
This is behaviour of elixir to show string '' as list of numbers.
As Erlang/Elixir has 2 types of strings: binary strings and strings as lists of integers.