base-4.18.0.0: Basic libraries
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.Encoding.UTF8

Description

Simple UTF-8 codecs supporting non-streaming encoding/decoding. For encoding where codepoints may be broken across buffers, see GHC.IO.Encoding.UTF8.

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

utf8DecodeCharAddr# :: Addr# -> Int# -> (# Char#, Int# #) Source #

Decode a single character at the given Addr#.

utf8DecodeCharPtr :: Ptr Word8 -> (Char, Int) Source #

Decode a single codepoint starting at the given Ptr.

utf8DecodeCharByteArray# :: ByteArray# -> Int# -> (# Char#, Int# #) Source #

Decode a single codepoint starting at the given byte offset into a ByteArray#.

Decoding strings

Counting characters

Comparison

Encoding strings