uni-util-2.2.1.0: Utilities for the uniform workbench

Util.UTF8

Description

This module contains functions for converting to and from the UTF8 representations for Strings.

Synopsis

Documentation

toUTF8 :: Enum byte => String -> [byte]Source

Converts a String into its UTF8 representation.

fromUTF8WE :: (Enum byte, Monad m) => [byte] -> m StringSource

Converts a UTF8 representation of a String back into the String, catching all possible format errors.

Example: With the Haskell module Control.Monad.Error, you can instance this as (fromUTF8WE :: String -> Either String String) to get a conversion function which either succeeds (Right) or returns an error message (Left).