Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strings read from application env are no longer utf8 strings #9225

Closed
Adzz opened this issue Jul 15, 2019 · 0 comments
Closed

Strings read from application env are no longer utf8 strings #9225

Adzz opened this issue Jul 15, 2019 · 0 comments

Comments

@Adzz
Copy link
Contributor

Adzz commented Jul 15, 2019

Environment

  • Elixir: 1.9.0 Erlang: 22.0.5
  • Operating system: Unix

Current behavior

I'm not really sure if this is intended behaviour but when using mix releases in elixir 1.9 any strings fetched from the Application config, whether you use the new Config module or not, seem to copy not as utf8 strings.

I can confirm this didn't happen with distillery releases on 1.8.1, and it doesn't happen if you use elixir 1.9 and do iex -S mix locally. However if you use a mix release it will happen.

This is causing an issue because some of our config contains this string: £. In the old world this would become the valid utf8 binary:

<<194, 163>>

and everything works. But with 1.9 and releases this becomes:

<<163>>

Which means if we try to encode it with Jason, e.g., it blows up and breaks things.

I have made a repo with a minimal test case here: https://github.com/Adzz/minimal if you clone and make a release, start_iex then run the function you'll see the invalid string. If you boot with iex -S mix instead you will see the difference.

We can fix our issue by getting rid of that config, but now I am concerned about other bits of config changing.

Expected behavior

I guess the strings become valid utf8 strings?

josevalim pushed a commit that referenced this issue Jul 18, 2019
Closes #9225

Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant