An invisible character when reading csv file

the code is here


  def f() do
    File.read!("15821.csv")
    |> String.split("\r", trim: true)
    |> Enum.map(fn x -> String.split(x, ",") end)
    |> Enum.group_by(fn x -> Enum.at(x, 0) end)
  end

the csv file is here: https://github.com/cjen07/groupby_question/blob/master/15821.csv
there are four keys in output, but you cannot identify why by just inspecting in iex

I think the invisible character comes from the headline of the csv file, but why is it permitted in elixir?

1 Like

There is a BOM in that file, remove it.

xxd file really helps to identify such issues. xxd is part of most vim distributions.

3 Likes