@@ -83,6 +83,8 @@ import qualified Data.Text.Encoding.Utf16 as U16
8383import qualified Data.Text.Fusion as F
8484import Data.Text.Unsafe (unsafeDupablePerformIO)
8585
86+#include "text_cbits.h"
87+
8688-- $strict
8789--
8890-- All of the single-parameter functions for decoding bytestrings
@@ -169,7 +171,7 @@ decodeUtf8With' onErr = decodeChunk (0,0)
169171 codepointPtr statePtr
170172 state <- peek statePtr
171173 case state of
172− 12 -> do
174+ UTF8_REJECT -> do
173175 -- We encountered an encoding error
174176 x <- peek curPtr'
175177 case onErr desc (Just x) of
@@ -181,7 +183,7 @@ decodeUtf8With' onErr = decodeChunk (0,0)
181183 poke destOffPtr (destOff + fromIntegral w)
182184 poke statePtr 0
183185 loop $ curPtr' `plusPtr` 1
184−
186+
185187 _ -> do
186188 -- We encountered the end of the buffer while decoding
187189 n <- peek destOffPtr