Read compressed files as string and not bitstring

Strings in Elixir are, by definition, UTF-8 encoded.

When you inspect a binary (a binary is a bitstring that is divisible by 8 bits - therefore a String is also a binary encoded as UTF-8), Elixir will output it as a string if it is valid UTF-8. It will output it as a binary if it is not.

Therefore basically your data is not valid UTF-8 and is therefore not a String.

You can chunk the binary by the valid String parts as follows:

iex> binary = <<253, 55, 122, 88, 90, 0, 0, 4, 230, 214, 180, 70, 2, 0, 33, 1, 22, 0, 0, 0, 116, 47, 229, 163, 224, 46, 175, 14, 134, 93, 0, 22, 233>>
iex> String.chunk(binary, :valid)
[
  <<253>>,
  <<55, 122, 88, 90, 0, 0, 4>>,
  <<230>>,
  <<214, 180, 70, 2, 0, 33, 1, 22, 0, 0, 0, 116, 47>>,
  <<229, 163, 224>>,
  ".",
  <<175>>,
  <<14>>,
  <<134>>,
  <<93, 0, 22>>,
  <<233>>
]

That suggests your data is encoded in some very different way to UTF-8.