From: Simon Marlow Date: Fri, 14 May 2010 12:46:28 +0000 (+0000) Subject: hSetEncoding: change the encoding on both read and write sides (#4066) X-Git-Url: http://git.megacz.com/?p=ghc-base.git;a=commitdiff_plain;h=3689c8ff0c75a7bf1f8714421847703269652a83 hSetEncoding: change the encoding on both read and write sides (#4066) --- 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.