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.
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.