IO.inspect is infering the list as chartists and printing as same. This is the default behaviour for inspect.
:charlists - when :as_charlists all lists will be printed as charlists, non-printable elements will be escaped.When :as_lists all lists will be printed as lists. When the default :infer, the list will be printed as a charlist if it is printable, otherwise as list. See List.ascii_printable?/1 to learn when a charlist is printable.
For every project, I add the following configuration in .iex.exs file. This helps for my iex sessions during development.
# .iex.exs file in root folder of project.
IEx.configure(inspect: [charlists: :as_lists])
You can learn about .iex.exs file from docs - .iex.exs
When starting, IEx looks for a local .iex.exs file (located in the current working directory), then a global one (located at ~/.iex.exs ) and loads the first one it finds (if any).