Repository navigation
Description
This is a meta-issue collecting all information about stack, and tools stack calls, failing in the case that you have a non-ASCII char in your user name on Windows.
For example, if you name your Windows user 日 so your home dir, including some stack related files, will be under C:\Users\日.
The goal for this issue to be closed is that you can just install stack and compile small and large big Haskell projects successfully without roadblocks, even when your user is named that way.
In general, there are two settings on Windows that affect the encoding behaviour:
- The global system locale setting (as can be set this way)
- The per-terminal/process code page (as can be seen/set using
chcpin cmd.exe or PowerShell)
Extra problems in the usage of stack arise when you have are using paths with non-unicode file names, but have set the system locale set to English (United states), like shown here:
As per my current understanding, if programmed correctly, applications can be made to work no matter what your locale, code page, and user name is. When something doesn't work (as shown in various cases below), it usually indicates a bug in stack or (in most cases I've encountered so far) one of the upstream programs that it calls.
We'd like to fix all of those, in stack or upstreams, so that
- developers who happen to have non-ASCII user names names don't have a harder time working with Haskell
- developers can efficiently test whether their compiled projects work fine for non-ASCII users, by being able to run the change-compile-run workflow under a user with non-ASCII chars in its name
Maintained list of known issues:
- GHC bug: ghc-pkg list crashes on Windows when unicode character is in the path
- This happens with some combinations of system locale and code page (details in the bug) when
stack buildcalls out toghc-pkg list.
- This happens with some combinations of system locale and code page (details in the bug) when
-
stack setupfailing withcommitBuffer: invalid argument (invalid character)- That issue is closed and a documented workaround is to set the system locale English (US)` but that's not good enough because other things fail when that is done.
- stack fails unpacking ghc on Windows under non-ASCII path because 7zip version is too old
- GHC bug: GHC fails to execute gcc on Windows when unicode character is in the path
- This happens at the end of
stack setupwhen stack tries to compile thestack-sanity-checkfile.
- This happens at the end of

Activity
nh2 commentedon Apr 27, 2018
The kind people on the haskell-jp Slack let me know that many of them change their user names to ASCII chars in order to work around problems as covered by this issue.
Let's make that a thing of the past!
nh2 commentedon Apr 28, 2018
Found another issue: https://ghc.haskell.org/trac/ghc/ticket/15096
For the full invocation see #3987 (comment).
koflerdavid commentedon May 3, 2018
Here is another: msys2/MINGW-packages#3976
BjoernLoetters commentedon Sep 8, 2022
I just ran into this problem (as my name and windows username contains the letter
ö) and found this issue. More than 4 years have passed and it does not seem like this issue is resolved. Is there any progress regarding the support of unicode paths in stack? It's extremely frustating for people like me, that this is still an open issue in 2022.Steps to reproduce:
stack setupChanging the code page of the shell to 65001 (UTF-8) does not fix the issue but triggers another exception:
Maybe this issue is also related to
ghcand/or the way howstackinvokesghc?hasufell commentedon Sep 9, 2022
The way forward is simply using the new filepath types: https://hasufell.github.io/posts/2022-06-29-fixing-haskell-filepaths.html
mpilgrem commentedon Sep 9, 2022
@kuchenkruste, thanks for reporting this. I'm a Windows user myself, so I want Stack to support fully Windows users (which is one of its stated goals). To help me understand better your circumstances, can you tell me your Windows version, the terminal software you are using, and the version of Stack (
stack --version).mpilgrem commentedon Sep 9, 2022
I tied this experiment with Stack (which is not @kuchenkruste's problem, that problem is the path to the Stack-supplied GHC):
I changed my Stack root to C:\test\björn\sr:
I commanded
stack new my-projectandcd new-projectandstack build. It fails with (I've reformatted the output to make it clearer):GCC is GHC-supplied:
The version of GCC is:
My immediate reaction (I may be wrong) is that seems to be an upstream problem with the MSYS2-supplied
gcc.exe. Some of my searches suggests that Cygwin lacks Unicode support (see, for example, msys2/MSYS2-packages#6447 - which is from as recently as October 2020). I understand that some parts of MSYS2 build upon Cygwin (see, for example, https://www.msys2.org/wiki/How-does-MSYS2-differ-from-Cygwin/).I think the sorry answer is that Stack's ability to support 'björn' (etc) in some paths is currently constrained by the inability of the tools on which Stack relies to support it.
mpilgrem commentedon Sep 9, 2022
Based on my experiments, @kuchenkruste, the 'raw' command:
would fail because the GHC-supplied GCC can't handle the path to
Main.hs.I think the work-around is to use Stack's global YAML configuration (
config.yaml) to setlocal-programs-pathto be a path that the GHC-supplied GCC can tolerate. See https://docs.haskellstack.org/en/stable/yaml_configuration/#local-programs-path.mpilgrem commentedon Sep 9, 2022
I should add (1) I am using Windows Terminal on Windows 11 (with a UK/English set up) and (2) that my experiments included using GHC directly, with:
This fails with:
mpilgrem commentedon Sep 9, 2022
There is also GHC issue #12971 'Paths are encoded incorrectly when invoking GCC' from five years ago, where @Mistuke identified the problem as being 'upstream'.
mpilgrem commentedon Mar 20, 2024
I am closing this issue because repeating my experiment above, things now work as intended.