Sun Jun 14 11:53:32 PDT 2009 Simon Marlow <[email protected]>
* Save and restore the codec state when re-decoding
Ignore-this: 62b247a51efc2eed65d933f982b06894
We previously had an ugly hack to check for a BOM when re-decoding
some binary data in flushCharBuffer. The hack was there essentially
because codecs like UTF-16 have a state, and we had not restored it.
This patch gives codecs an explicit state, and implemented
saving/restoring of the state as necessary. Hence, the hack in
flushCharBuffer is replaced by a more general mechanism that works for
any codec with state.
Unfortunately, iconv doesn't give us a way to save and restore the
state, so this is currently only implemented for the built-in codecs.
M ./GHC/IO/Encoding/Iconv.hs -2 +5
M ./GHC/IO/Encoding/Latin1.hs -6 +24
M ./GHC/IO/Encoding/Types.hs -8 +25
M ./GHC/IO/Encoding/UTF16.hs -14 +46
M ./GHC/IO/Encoding/UTF32.hs -13 +46
M ./GHC/IO/Encoding/UTF8.hs -4 +16
M ./GHC/IO/Handle.hs -4 +12
M ./GHC/IO/Handle/Internals.hs -32 +37
M ./GHC/IO/Handle/Types.hs -4 +4
View patch online:
http://darcs.haskell.org/packages/base/_darcs/patches/20090614185332-12142-e84f084d046a6bc89b2e51e60496e8a81b192800.gz
_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries