Skip to content

loses encoding of silenced handles #2

@joeyh

Description

@joeyh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions