ghc-boot-9.12.0.20241031: Shared functionality between GHC and its boot libraries
Safe HaskellNone
LanguageHaskell2010

GHC.Utils.Encoding.UTF8

Description

Simple, non-streaming Modified UTF-8 codecs.

This is one of several UTF-8 implementations provided by GHC; see Note [GHC's many UTF-8 implementations] in GHC.Encoding.UTF8 for an overview.

Synopsis

Decoding single characters

utf8PrevChar :: Ptr Word8 -> IO (Ptr Word8) Source #

Find the start of the codepoint preceding the codepoint at the given Ptr. This is undefined if there is no previous valid codepoint.

utf8CharStart :: Ptr Word8 -> IO (Ptr Word8) Source #

Find the start of the codepoint at the given Ptr. This is undefined if there is no previous valid codepoint.

Decoding strings

utf8DecodeByteString :: ByteString -> [Char] Source #

Decode a ByteString containing a UTF-8 string.

Counting characters

Comparison

Encoding strings