Difference between :utf8 and :encoding option in File.open

Hello!

when I open a file:

https://hexdocs.pm/elixir/File.html#open/2

What is the difference between passing :utf8 in the list of modes versus using encoding: :utf8 ?
(Erlang -- file)

Is the first form a shorthand for the second one?

I tried to play around with both but didn’t notice any difference.

Yes: elixir/lib/elixir/lib/file.ex at v1.13.1 · elixir-lang/elixir · GitHub

2 Likes

Thanks. I find the documentation of the :utf8 option misleading. It should simply state that it’s an alias for {:encoding, :utf8}. One line.

Instead, the description doesn’t even use the word “encoding” but attempts to describe what encoding actually is. This is confusing and makes one wonder what the whole thing is supposed to be about.