codepagex
codepagex copied to clipboard
Inconsistent "from_string/4" return types
Hello.
I was testing some of the functions of the main module and found out that the returned types from from_string/4 are not always as shown in the documentation. Here some exemple:
iex(9)> from_string("Água", :ascii, replace_nonexistent(""))
{:ok, "gua", 1}
iex(10)> from_string("Água", :iso_8859_1, replace_nonexistent(""))
{:ok, <<193, 103, 117, 97>>, nil}
Using the :iso_8859_1 encoding a binary is returned but with the ascii a string is returned. Is that the right behaviour?
I believe both results have binary types, its just how Elixir will print them that differs