Community
Modules 50

Data.Text.Internal.Encoding.Utf8

License : BSD-style Maintainer : bos@serpentine.com Stability : experimental Portability : GHC

Warning: this is an internal module, and does not have a stable API or name. Functions in this module may not check or enforce preconditions expected by public modules. Use at your own risk!

Basic UTF-8 validation and character manipulation.

utf8Length :: Char -> Int

Measure byte length of UTF-8 encoding for a given character.

utf8LengthByLeader :: Word8 -> Int

Measure byte length of UTF-8 encoding for characters, starting with a given byte.

ord2 :: Char -> (Word8, Word8)

Encode a character as UTF-8 bytes assuming that exactly 2 are needed. This precondition is not checked.

ord3 :: Char -> (Word8, Word8, Word8)

Encode a character as UTF-8 bytes assuming that exactly 3 are needed. This precondition is not checked.

ord4 :: Char -> (Word8, Word8, Word8, Word8)

Encode a character as UTF-8 bytes assuming that exactly 4 are needed. This precondition is not checked.

chr2 :: Word8 -> Word8 -> Char

chr3 :: Word8 -> Word8 -> Word8 -> Char

chr4 :: Word8 -> Word8 -> Word8 -> Word8 -> Char

Validation

validate3 :: Word8 -> Word8 -> Word8 -> Bool

validate4 :: Word8 -> Word8 -> Word8 -> Word8 -> Bool

Naive decoding

Instances

2
  • instance Eq DecoderState
  • instance Show DecoderState
Copyright
(c) 2008, 2009 Tom Harper, (c) 2009, 2010 Bryan O'Sullivan, (c) 2009 Duncan Coutts (c) 2021 Andrew Lelechenko
Build record and source files

Community contribution. The service has not verified this documentation. The generator reported 2 diagnostics.

Target: Linux on x86-64. Some inferred types and resolved links are not available.

Generator: aihc-haddock-858b1951-web-1

Metadata snapshot: 0b0724abd14577f7a6c8172d62e3e1c0808feb114d4d379402e17f37e3c7801e

Open the dependency plan · Download the documentation model

Import a package

Enter a package name and an exact version from Hackage. The site contains imported versions only.