hexpm / hex

Package manager for the Erlang ecosystem.
https://hex.pm
976 stars 187 forks source link

No Emoji Support (Computer Name) #1053

Open LeonNikolai opened 1 month ago

LeonNikolai commented 1 month ago

I have had my computer name be πŸš€ (a rocket emoji) for a while, i recently decided to learn and install Erlang, Elixir, and Phoenix. When i reached Phoenix's installation step of "mix archive.install hex phx_new" i crashed. I struggled to figure out why. Until I realized its something Unicode, when i got a suspicion. I preceded to rename my computer to pure ascii characters, and I could run it just fine. I'm not sure if this is a Hex, Erlang, or Phoenix Issue, but from what I can tell its a Hex one.


PS C:\Users\leon\Desktop\PhoenixTest> mix archive.install hex phx_new

22:49:17.002 [notice] Application hex exited: Hex.Application.start(:normal, []) returned an error: shutdown: failed to start child: Hex.State
    ** (EXIT) an exception was raised:
        ** (UnicodeConversionError) invalid code point 55357
            (elixir 1.17.3) lib/list.ex:1103: List.to_string/1
            (elixir 1.17.3) lib/system.ex:627: anonymous fn/1 in System.get_env/0
            (elixir 1.17.3) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
            (elixir 1.17.3) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
            (elixir 1.17.3) lib/map.ex:262: Map.new_from_enum/2
            (hex 2.1.1) lib/hex/state.ex:234: Hex.State.load_config_value/3
            (hex 2.1.1) lib/hex/state.ex:155: anonymous fn/3 in Hex.State.init/1
            (elixir 1.17.3) lib/map.ex:257: Map.do_map/2

22:49:17.013 [notice] Application inets exited: :stopped
22:49:17.018 [notice] Application ssl exited: :stopped
22:49:17.019 [notice] Application public_key exited: :stopped
22:49:17.019 [notice] Application asn1 exited: :stopped
22:49:17.019 [notice] Application crypto exited: :stopped
Could not start Hex. Try fetching a new version with "mix local.hex" or uninstalling it with "mix archive.uninstall hex.ez"
ericmj commented 1 week ago

Can you run System.get_env() inside an iex shell?

I don't know what encoding Windows environment variables have or if Erlang does some kind of conversion between the OS the Erlang runtime but whatever we get back from Erlang is not valid Unicode which is what we expect.

This seems to be either an Erlang issue or that you have a bad encoding in your environment variables.

As a note I can do this on macos:

FOO="πŸš€" iex                                                                               git:(main↓2|)
Erlang/OTP 27 [erts-15.0.1] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit]

Interactive Elixir (1.17.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> System.get_env("FOO")
"πŸš€"