From 3689c8ff0c75a7bf1f8714421847703269652a83 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Fri, 14 May 2010 12:46:28 +0000 Subject: [PATCH] hSetEncoding: change the encoding on both read and write sides (#4066) --- GHC/IO/Handle.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/GHC/IO/Handle.hs b/GHC/IO/Handle.hs index 1c61191..ff37738 100644 --- a/GHC/IO/Handle.hs +++ b/GHC/IO/Handle.hs @@ -268,7 +268,7 @@ hSetBuffering handle mode = -- hSetEncoding :: Handle -> TextEncoding -> IO () hSetEncoding hdl encoding = do - withHandle "hSetEncoding" hdl $ \h_@Handle__{..} -> do + withAllHandles__ "hSetEncoding" hdl $ \h_@Handle__{..} -> do flushCharBuffer h_ openTextEncoding (Just encoding) haType $ \ mb_encoder mb_decoder -> do bbuf <- readIORef haByteBuffer @@ -276,8 +276,7 @@ hSetEncoding hdl encoding = do return (Handle__{ haLastDecode = ref, haDecoder = mb_decoder, haEncoder = mb_encoder, - haCodec = Just encoding, .. }, - ()) + haCodec = Just encoding, .. }) -- | Return the current 'TextEncoding' for the specified 'Handle', or -- 'Nothing' if the 'Handle' is in binary mode. -- 1.7.10.4