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

loses encoding of silenced handles #2

Open
joeyh opened this issue Dec 22, 2016 · 1 comment
Open

loses encoding of silenced handles #2

joeyh opened this issue Dec 22, 2016 · 1 comment

Comments

@joeyh
Copy link

joeyh commented Dec 22, 2016

ghci> hSetEncoding stderr utf16
ghci> hGetEncoding stderr
Just UTF-16
ghci> hSilence [stderr] $ print "hi"
"hi"
ghci> hGetEncoding stderr
Just UTF-8

So, encoding was UTF-16, but after stderr was closed and reopened, went back to the default UTF-8.

This is a bad and unexpected side effect. Especially when a library is using silently internally, as in yesodweb/persistent#474

I think it can easily be fixed by getting the old encoding, and restoring it when re-opening the handle.

@sol
Copy link
Member

sol commented Jan 8, 2017

@joeyh Thanks for bringing this up and sorry for the late reply. Patches welcome!

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

No branches or pull requests

2 participants