Hoogle Search
Within LTS Haskell 24.3 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
decodeUtf8More :: Utf8State -> ByteString -> (StrictTextBuilder, ByteString, Maybe Utf8State)text Data.Text.Internal.Encoding Decode another chunk in an ongoing UTF-8 stream. Returns a triple:
- A StrictBuilder for the decoded chunk of text. You can accumulate chunks with (<>) or output them with toText.
- The undecoded remainder of the given chunk, for diagnosing errors and resuming (presumably after skipping some bytes).
- Just the new state, or Nothing if an invalid byte was encountered (it will be within the first 4 bytes of the undecoded remainder).
Properties
Given:(pre, suf, ms) = decodeUtf8More s chunk
- If the output pre is nonempty (alternatively, if
length chunk > length suf)
s2b pre `append` suf = p2b s `append` chunk
wheres2b = encodeUtf8 . toText p2b = partUtf8ToByteString
- If the output pre is empty (alternatively, if length
chunk = length suf)
suf = chunk
- Decoding chunks separately is equivalent to decoding their
concatenation.Given:
(pre1, suf1, Just s1) = decodeUtf8More s chunk1 (pre2, suf2, ms2) = decodeUtf8More s1 chunk2 (pre3, suf3, ms3) = decodeUtf8More s (chunk1 `B.append` chunk2)
we have:s2b (pre1 <> pre2) = s2b pre3 ms2 = ms3
decodeUtf8With1 :: OnDecodeError -> String -> ByteString -> Texttext Data.Text.Internal.Encoding Helper for decodeUtf8With.
-
text Data.Text.Internal.Encoding Helper for decodeUtf8With, streamDecodeUtf8With, and lazy decodeUtf8With, which use an OnDecodeError to process bad bytes. See decodeUtf8Chunk for a more flexible alternative.
decodeUtf8' :: ByteString -> Either UnicodeException Texttext Data.Text.Lazy.Encoding Decode a ByteString containing UTF-8 encoded text.. If the input contains any invalid UTF-8 data, the relevant exception will be returned, otherwise the decoded text. Note: this function is not lazy, as it must decode its entire input before it can return a result. If you need lazy (streaming) decoding, use decodeUtf8With in lenient mode.
decodeUtf8With :: OnDecodeError -> ByteString -> Texttext Data.Text.Lazy.Encoding Decode a ByteString containing UTF-8 encoded text.
decodeUtf8C :: forall (m :: Type -> Type) . MonadThrow m => ConduitT ByteString Text m ()conduit Conduit Decode a stream of binary data as UTF8.
decodeUtf8LenientC :: forall (m :: Type -> Type) . Monad m => ConduitT ByteString Text m ()conduit Conduit Decode a stream of binary data as UTF8, replacing any invalid bytes with the Unicode replacement character.
decodeUtf8Lenient :: forall (m :: Type -> Type) . Monad m => ConduitT ByteString Text m ()conduit Data.Conduit.Combinators Decode a stream of binary data as UTF8, replacing any invalid bytes with the Unicode replacement character.
decodeUtf8Lenient :: forall (m :: Type -> Type) . Monad m => ConduitT ByteString Text m ()conduit-extra Data.Conduit.Text Decode a stream of binary data as UTF8, replacing any invalid bytes with the Unicode replacement character.
decodeUtf8Pure :: ByteString -> DecodeResultstreaming-commons Data.Streaming.Text O(n) Convert a ByteString into a 'Stream Char', using UTF-8 encoding.