Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

Add option for stdio encoding, set stdin encoding #747

Merged
merged 3 commits into from
Feb 9, 2016
Merged

Add option for stdio encoding, set stdin encoding #747

merged 3 commits into from
Feb 9, 2016

Conversation

lierdakil
Copy link
Collaborator

@lierdakil lierdakil closed this Feb 9, 2016
@lierdakil lierdakil reopened this Feb 9, 2016
@lierdakil
Copy link
Collaborator Author

This is a pretty straightforward change. Only point of discussion I can see is whether optparse-applicative messages should use system encoding (in current version), or respect one set with --encoding. I'm betting on former, since those messages don't make much sense outside of console. Besides, changing stdout encoding before optparse-applicative does its thing would be reasonably convoluted.

@DanielG, I'd rather merge this sooner rather than later, if you don't mind, since it can cause interactive interface breakage on Windows machines if stdin encoding isn't set explicitly.

P.S. Also, might be a good idea to coach HLint into using encoding specified here, but I'll leave that for another PR, since it's not directly related.

@@ -107,7 +110,6 @@ getFileSourceFromStdin = do
then fmap (x:) readStdin'
else return []

-- Someone please already rewrite the cmdline parsing code *weep* :'(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's been there for a while now. I thought that this is as good a time as any to remove it.

@DanielG
Copy link
Owner

DanielG commented Feb 9, 2016

Looks perfectly fine to me feel free to merge it. Do you need this released soon too?

@lierdakil
Copy link
Collaborator Author

If you plan on doing a minor release after all, I'd prefer it included there, I think. I can rebase on stable-5.5 and make a separate PR for that.

lierdakil added a commit that referenced this pull request Feb 9, 2016
Add option for stdio encoding, set stdin, stderr encoding
@lierdakil lierdakil merged commit 721951e into DanielG:master Feb 9, 2016
@lierdakil lierdakil mentioned this pull request Feb 9, 2016
@DanielG
Copy link
Owner

DanielG commented Feb 17, 2016

Looks like this broke something on my end:

ghc-mod: <somewhere>/cabal-sandbox/x86_64-linux-ghc-7.10.3-packages.conf.d/package.cache: GHC.PackageDb.readPackageDb: inappropriate type (Not a valid Unicode code point!)

Probably shouldn't be forcing the encoding but rather only setting it when that's requested on the cmdline.

@DanielG
Copy link
Owner

DanielG commented Feb 17, 2016

See #758

@lierdakil
Copy link
Collaborator Author

This is weird. I only set stdin/stderr encoding (stdout was utf-8 anyway),
so unless readPackageDb gets its information from stdin, this shouldn't be
an issue, and I don't think it does? I think we're better off getting to
the bottom of this issue rather than reverting to using system encoding
unless specified. This will come up sooner or later if we don't.

See #758 #758


Reply to this email directly or view it on GitHub
#747 (comment).

@DanielG
Copy link
Owner

DanielG commented Feb 18, 2016

Maybe readProcess bases the encoding it uses on that of stdin/out or something like that? I did think that was weird too.

@DanielG
Copy link
Owner

DanielG commented Feb 18, 2016

Nevermind there is no readProcess in that code path GHC reads that directly it looks like.

@DanielG
Copy link
Owner

DanielG commented Feb 18, 2016

And of course I can't reproduce that now after rebuilding without the patch -.-

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants