[GHC] #9114: Invalid UTF8 not round-tripped correctly
GHC
ghc-devs at haskell.org
Thu May 15 11:58:33 UTC 2014
#9114: Invalid UTF8 not round-tripped correctly
-------------------------------------+------------------------------------
Reporter: nomeata | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: libraries/base | Version: 7.6.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Comment (by nomeata):
No, I believe the bug is in `GHC.IO.Encoding` or `GHC.IO.Encoding.UTF8`. I
tried to give an example using that interface, but failed to work with
these buffers; the following code always prints `'\NUL'`:
{{{
import GHC.IO.Encoding
import GHC.IO.Buffer
import GHC.IO.Encoding.Types
main = do
te <- getFileSystemEncoding
case te of
TextEncoding _ decIO _ -> do
BufferCodec encode recover close getState setState <- decIO
bb <- newByteBuffer 2 ReadBuffer
writeWord8Buf (bufRaw bb) 0 0xC0
writeWord8Buf (bufRaw bb) 1 0xB7
checkBuffer bb
cb <- newCharBuffer 1 WriteBuffer
(InputUnderflow,_,cb') <- encode bb cb
close
c <- peekCharBuf (bufRaw cb') 0
print c
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9114#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list