X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FIO%2FHandle.hs;fp=GHC%2FIO%2FHandle.hs;h=0330cb39bda48608b64a4993d3566b1ec0336636;hb=b5c54282dc54cc861277ae532224775076a4818e;hp=bf706e00d3713e6ea994fb72820396a951aaf3a6;hpb=dc372329214c1e8ef32f1a20173c3e8cc6dc0572;p=ghc-base.git diff --git a/GHC/IO/Handle.hs b/GHC/IO/Handle.hs index bf706e0..0330cb3 100644 --- a/GHC/IO/Handle.hs +++ b/GHC/IO/Handle.hs @@ -270,6 +270,7 @@ hSetEncoding :: Handle -> TextEncoding -> IO () hSetEncoding hdl encoding = do withAllHandles__ "hSetEncoding" hdl $ \h_@Handle__{..} -> do flushCharBuffer h_ + closeTextCodecs h_ openTextEncoding (Just encoding) haType $ \ mb_encoder mb_decoder -> do bbuf <- readIORef haByteBuffer ref <- newIORef (error "last_decode") @@ -572,6 +573,7 @@ hSetBinaryMode handle bin = withAllHandles__ "hSetBinaryMode" handle $ \ h_@Handle__{..} -> do flushCharBuffer h_ + closeTextCodecs h_ let mb_te | bin = Nothing | otherwise = Just localeEncoding