Why isn’t there a consistent output? If single-quoted strings are character lists, why are the code points only revealed when the string contains multi-byte characters? How can I see the internal integer codepoints of any single-quoted string?
Strings/charlists are confusing enough without the obfuscation. Could someone shed light on this?
If all integers in the list are ASCII characters, iex displays it as a string as a convenience. Quickest, but hacky, way to see integers is append a 0, 'hello' <> <<0>>
The reason for sometimes printing lists of integers as ' ' strings is that this is how strings are represented in Erlang, as lists of unicode codepoints. And the reason for this is that there is no string datatype in the BEAM, no character datatype either for that matter. So we fake strings.
In Erlang with lists of integers, which is a “classic” way of doing it in functional languages, and in Elixir with binaries containing UTF-8 encode chararcters.