-
Notifications
You must be signed in to change notification settings - Fork 151
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
set stdio encoding to utf-8 on windows #108
Comments
Yeah, I agree that this is a good idea, since it seems UTF-8 is at least how GHC reads files (source). We can do this on all platforms and allow users to disable it with a command-line option. |
but just adding hSetEncoding stdout utf8
readUTF8File fileName >>= putStr doesn't help with atom, cc @lierdakil |
That's probably because ide-haskell uses stylish-haskell as filter, i.e. source is passed on stdin instead of file. Try to |
@lierdakil no effect and no error messages |
Another approach could be using the |
@Heather, I think you might be hacking on the wrong part of stylish-haskell there... lines 52-55 of You might want to do this in Minimal example: main :: IO ()
main = do
mapM_ (`hSetEncoding` utf8) [stdin, stdout]
cmdArgs stylishArgs >>= stylishHaskell |
@jaspervdj seems like helped #109 |
@jaspervdj btw, it doesn't work with CPP things alike |
Yes @Heather, CPP is impossible to parse in some cases, so stylish-haskell doesn't try. |
That would be my job... Sigh. I'll have to check version of stylish-haskell
|
@jaspervdj sure I can test it some later, it doesn't use change I used to add so result could be different +readUTF8File :: FilePath -> IO String
+readUTF8File fp = do
+ content <- B.readFile fp
+ let utf = decodeUtf8 content
+ return (T.unpack utf) |
@lierdakil oh, in that case I can make it the default. It shouldn't hurt. @Heather That code is not used if you're just using |
If you could make it default, that would be great. Thanks.
|
I've uploaded |
related issue: atom-haskell/ide-haskell-cabal#11 (comment)
when I run
chcp 65001
it helps but it seems like it could break integration with other thingsis it possible to set stdio encoding to utf-8 on windows?
The text was updated successfully, but these errors were encountered: