Commit 38e98e3f authored by Simon Marlow's avatar Simon Marlow

hSetEncoding: change the encoding on both read and write sides (#4066)

parent 39aa14de
......@@ -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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment