Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Simple, non-streaming 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
- utf8DecodeCharAddr# :: Addr# -> Int# -> (# Char#, Int# #)
- utf8DecodeCharPtr :: Ptr Word8 -> (Char, Int)
- utf8DecodeCharByteArray# :: ByteArray# -> Int# -> (# Char#, Int# #)
- utf8PrevChar :: Ptr Word8 -> IO (Ptr Word8)
- utf8CharStart :: Ptr Word8 -> IO (Ptr Word8)
- utf8UnconsByteString :: ByteString -> Maybe (Char, ByteString)
- utf8DecodeByteString :: ByteString -> [Char]
- utf8DecodeShortByteString :: ShortByteString -> [Char]
- utf8DecodeForeignPtr :: ForeignPtr Word8 -> Int -> Int -> [Char]
- utf8DecodeByteArray# :: ByteArray# -> [Char]
- utf8CountCharsShortByteString :: ShortByteString -> Int
- utf8CountCharsByteArray# :: ByteArray# -> Int
- utf8CompareByteArray# :: ByteArray# -> ByteArray# -> Ordering
- utf8CompareShortByteString :: ShortByteString -> ShortByteString -> Ordering
- utf8EncodeByteArray# :: String -> ByteArray#
- utf8EncodePtr :: Ptr Word8 -> String -> IO ()
- utf8EncodeByteString :: String -> ByteString
- utf8EncodeShortByteString :: String -> ShortByteString
- utf8EncodedLength :: String -> Int
Decoding single characters
utf8DecodeCharAddr# :: Addr# -> Int# -> (# Char#, Int# #) #
Decode a single character at the given Addr#
.
utf8DecodeCharByteArray# :: ByteArray# -> Int# -> (# Char#, Int# #) #
Decode a single codepoint starting at the given byte offset into a
ByteArray#
.
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.
utf8UnconsByteString :: ByteString -> Maybe (Char, ByteString) Source #
Decoding strings
utf8DecodeByteString :: ByteString -> [Char] Source #
Decode a ByteString
containing a UTF-8 string.
utf8DecodeForeignPtr :: ForeignPtr Word8 -> Int -> Int -> [Char] #
utf8DecodeByteArray# :: ByteArray# -> [Char] #
Counting characters
Comparison
utf8CompareByteArray# :: ByteArray# -> ByteArray# -> Ordering #
Encoding strings
utf8EncodeByteString :: String -> ByteString Source #
Encode a String
into a ByteString
.
utf8EncodedLength :: String -> Int #