Skip to content

openTempFile does not apply an encoding to the stream

In the following program, the output is written as a raw byte, even in a UTF locale:

module Main where

import System.IO

main = do
        (_, h) <- openTempFile "." "test.txt"
        hPutStrLn h $ "\xa9" -- Copyright symbol
        hClose h
Trac metadata
Trac field Value
Version 6.12.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information