Skip to content

does not respect setLocaleEncoding when opening a Handle #45

@joeyh

Description

@joeyh

setLocaleEncoding is supposed to set an encoding that is used by default for all opened Handles. And by default the encoding is set based on the locale settings. But file-io does not use that encoding:

ghci> System.IO.withFile ("/etc/passwd") ReadMode (\h -> print =<< hGetEncoding h)
Just UTF-8
ghci> import System.OsPath
ghci> f <- encodeFS "/etc/passwd"
ghci> System.File.OsPath.withFile f ReadMode (\h -> print =<< hGetEncoding h)
Nothing

This means that, when converting existing code from FilePath to OsPath, any use of file-io for opening a Handle that is used with String based operations risks introducing a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions