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

Can't use UTF-8 on Windows 7 64 bit #6600

Closed
lkppo opened this issue Sep 25, 2017 · 7 comments
Closed

Can't use UTF-8 on Windows 7 64 bit #6600

lkppo opened this issue Sep 25, 2017 · 7 comments

Comments

@lkppo
Copy link

lkppo commented Sep 25, 2017

Hello,

I have put in a file test.exs, encoded in UTF-8, the very first sample of the tutorial (IO.puts "Hello world from Elixir") and launched with PowerShell and cmd the command bellow :

> elixir.bat .\test.exs

I have also tested those commands :

> iex.bat
Interactive Elixir (1.5.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> IO.puts "BÉPO"
** (UnicodeConversionError) invalid encoding starting at <<144, 80, 79, 34, 10>>
    (elixir) lib/string.ex:1840: String.to_charlist/1
iex(1)> Terminer le programme de commandes (O/N) ? o
> chcp 65001
Page de codes active : 65001
> iex.bat
Interactive Elixir (1.5.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> IO.puts "BÉPO"

After I changes the page code, the output in iex with a É character never return! I can only use Ctrl+C to end.

Environment

  • Erlang/OTP 20 [erts-9.0] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] Elixir 1.5.1
  • Operating system: Windows 7 Pro 64 bit

Current behavior

> ** (SyntaxError) test.exs:1: unexpected token: "´╗┐" (column 1, codepoint U+FEFF)
>     (elixir) lib/code.ex:376: Code.require_file/2

Expected behavior

> Hello world from Elixir

@josevalim
Copy link
Member

Can you try running iex.bat --werl and let us know if it works there? I believe this is a duplicate, I will try to find a previous one.

@josevalim
Copy link
Member

Found it! #5596

@lkppo
Copy link
Author

lkppo commented Sep 25, 2017

iex.bat --werl launch a erlang interpreter

werl
UTF-8 is ok with that.

@josevalim
Copy link
Member

josevalim commented Sep 25, 2017

Thanks for checking. If you follow the linked issue, we have reported this as an Erlang bug and it has unfortunately been tagged as won't fix. So you need to use --werl. You can set the IEX_WITH_WERL environment variable to 1 in your system configuration if you always want to use --werl.

@lkppo
Copy link
Author

lkppo commented Sep 25, 2017

Ok, I read the first report. Too bad. How can I execute my script with werl interpreter without opening it?

@josevalim
Copy link
Member

I am not quite sure if it is possible. AFAIK werl always open up as a separate window since it needs to use a completely separate input mode. You can try using other shells such as powershell and mingw.

@lkppo
Copy link
Author

lkppo commented Sep 25, 2017

Ok, I tried with Git Bash MINGW32 and it's half broken :

S@F MINGW32 ~
$ elixir text.exs
Hello world from Elixir

S@F MINGW32 ~
$ elixir text.exs
Hello world from Elixir BÉPO

With cygwin32 it works.

It can go for home scripts but I can not do DIY on a prod server. Pity.

Thanks for you help josevalim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants