@@ -83,6 +83,8 @@ import qualified Data.Text.Encoding.Utf16 as U16
83import qualified Data.Text.Fusion as F
83import qualified Data.Text.Fusion as F
84import Data.Text.Unsafe (unsafeDupablePerformIO)
84import Data.Text.Unsafe (unsafeDupablePerformIO)
86+#include "text_cbits.h"
88-- All of the single-parameter functions for decoding bytestrings
90-- All of the single-parameter functions for decoding bytestrings
@@ -169,7 +171,7 @@ decodeUtf8With' onErr = decodeChunk (0,0)
169 codepointPtr statePtr
171 codepointPtr statePtr
170 state <- peek statePtr
172 state <- peek statePtr
171 case state of
173 case state of
172− 12 -> do
174+ UTF8_REJECT -> do
173 -- We encountered an encoding error
175 -- We encountered an encoding error
174 x <- peek curPtr'
176 x <- peek curPtr'
175 case onErr desc (Just x) of
177 case onErr desc (Just x) of
@@ -181,7 +183,7 @@ decodeUtf8With' onErr = decodeChunk (0,0)
181 poke destOffPtr (destOff + fromIntegral w)
183 poke destOffPtr (destOff + fromIntegral w)
182 poke statePtr 0
184 poke statePtr 0
183 loop $ curPtr' `plusPtr` 1
185 loop $ curPtr' `plusPtr` 1
186 -- We encountered the end of the buffer while decoding
188 -- We encountered the end of the buffer while decoding
187 n <- peek destOffPtr
189 n <- peek destOffPtr