-
Notifications
You must be signed in to change notification settings - Fork 698
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
“lexical error (UTF-8 decoding error)” in WIndows 7 #912
Comments
(Imported comment by @dcoutts on 2012-03-02) Looks like cpp is outputting text that is not ASCII or UTF8. This then blows up because ghc expects .hs files to be UTF8. Cabal can perhaps work around this cpp quirk by calling ghc/cpp with LANG=C. The new program launching utils in Cabal should make it easier to set env vars like this. It'd be useful if someone could confirm this hypothesis. |
(Imported comment by @kosmikus on 2012-04-12) Most likely will require a change in the Cabal lib. |
@hamukazu is this still happening? |
Recently I haven't used cabal on Windows, so I checked it just now. I tested with latest version of Haskell Platform for Windows (2012.4.0.0) and MinGW (mingw-get-inst-20120426). The installation succeeded and UTF8 related error never reproduced even when I tried to install other packages after that. I regard this is fixed. |
This actually is a bug and is still happening. Duncan's diagnosis was correct. When you have configured Windows to use something other than English as the "locale for non Unicode programs" then mingw's CPP will output error messages and informational text in that locale. So for example, a C-preprocessed Haskell source file will have this at the top:
Where the text 命令行 (meaning 'command line interface', BTW) is actually encoded using the Chinese Windows code page rather than UTF-8. Running the C-preprocessor with LANG=C fixes this because it causes gcc's tools to output messages in English. |
Dont have access to a win 7 system to try to reproduce but it does not in windows 10 |
(Imported from Trac #922, reported by hamukazu on 2012-03-02)
Symptom
When I type
it fails with the following error:
Environment
It happens with 64 bit version of Windows 7.
It came to occur after I failed to install HXT. (I am not sure it is related.)
Workaround
By setting
in command line, cabal comes to work.
I regard this is just a workaround and this issue should be reported as a bug.
Related links
http://stackoverflow.com/questions/9371438/cabal-install-complains-built-in04-lexical-error-utf-8-decoding-error/9533205#9533205
http://trac.haskell.org/network/ticket/43
The text was updated successfully, but these errors were encountered: