silently
silently copied to clipboard
loses encoding of silenced handles
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 https://github.com/yesodweb/persistent/issues/474
I think it can easily be fixed by getting the old encoding, and restoring it when re-opening the handle.
@joeyh Thanks for bringing this up and sorry for the late reply. Patches welcome!