I noticed that mix
apparently “fails” to print Unicode characters correctly in my terminal. It’s also the only command on my machine that I am aware of that exhibits this behavior, hence my suspicion that it is caused by mix
one way or other.
Expected behavior
Well, mix
should print characters such as \x{2022}
and \x{2503}
as •
and ┃
, respectively.
Actual behavior
Examples below. Note the \x{2022}
instead of •
etc. Colors, e.g., background colors of headings, are correctly rendered.
$ mix phx.new
...
## Options
\x{2022} --umbrella - generate an umbrella project, with one application for
your domain, and a second application for the web interface.
\x{2022} --app - the name of the OTP application
..
mix credo
has the same problem.
$ mix credo
...
Code Readability
\x{2503}
\x{2503} [R] \x{2192} Modules should have a @moduledoc tag.
...
What I have already checked during my troubleshooting:
- Both my terminal (wezterm) and my font can successfully render the Unicode bullet character correctly.
$ echo -e '\u2022'
•
- My locales are set to UTF-8.
$ locale
LANG="en_US.utf-8"
LC_COLLATE="en_US.utf-8"
LC_CTYPE="en_US.utf-8"
LC_MESSAGES="en_US.utf-8"
LC_MONETARY="en_US.utf-8"
LC_NUMERIC="en_US.utf-8"
LC_TIME="en_US.utf-8"
LC_ALL="en_US.utf-8"
- FWIW, here’s the output of
mix phx.new
piped intocat -v
(-v
displays non-printing characters so they are visible.)
...
## Options
* `--umbrella` - generate an umbrella project, with one application for
your domain, and a second application for the web interface.
* `--app` - the name of the OTP application
...
- I also checked
iex
behavior, and it works prints the bullet character as expected.
❯ iex
iex(1)> IO.puts "\u2022"
•
:ok
iex(2)> IO.puts "\x{2022}"
warning: \x{H*} inside strings/sigils/chars is deprecated, please use \xHH (byte) or \uHHHH (code point) instead
•
:ok
Environment
- macOS 14.6.1 Sonoma
- wezterm version 20240203-110809-5046fc22 (same problem with iTerm2 3.5.4) with
zsh
- Mix 1.17.2 (compiled with Erlang/OTP 27)
- Erlang/OTP 27 [erts-15.0] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
- Elixir 1.17.2 (compiled with Erlang/OTP 27)
Has anyone come across this before? What else could I check?