---
name: "Glib.Utf8"
section: "3o"
platform: "linux"
package: "liblablgtk2-ocaml-doc"
version: "2.4.0v0.2tv-8"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/Glib.Utf8"
---

# Glib.Utf8(3o)

Unicode Manipulation

## NAME

Glib.Utf8 - Unicode Manipulation

## Module

Module   Glib.Utf8

## Documentation

Module **Utf8**\
  :  **sig end**

Unicode Manipulation

**=== UTF-8 handling, and conversion to UCS-4 ===**

*val validate* :  **string -\> bool**

If you read an UTF-8 string from somewhere, you should validate it, or risk random segmentation faults

*val length* :  **string -\> int**

*val from\_unichar* :  **Glib.unichar -\> string**

**from\_unichar 0xiii** converts a code point  **iii** (usually in hexadecimal form) into a string containing the UTF-8 encoded character  **0xiii** . See  unicode.org for charmaps. Does not check that the given code point is a valid unicode point.

*val from\_unistring* :  **Glib.unistring -\> string**

*val to\_unichar\_validated* :  **string -\> pos:int Pervasives.ref -\> Glib.unichar**

**to\_unichar\_validated** decodes an UTF-8 encoded code point and checks for incomplete characters, invalid characters and overlong encodings.

**Raises Convert.Error** if invalid

*val to\_unichar* :  **string -\> pos:int Pervasives.ref -\> Glib.unichar**

**to\_unichar** decodes an UTF-8 encoded code point. Result is undefined  if  **pos** does not point to a valid UTF-8 encoded character.

*val to\_unistring* :  **string -\> Glib.unistring**

**to\_unistring** decodes an UTF-8 encoded string into an array of **unichar** . The string must be valid.

*val first\_char* :  **string -\> Glib.unichar**

*val offset\_to\_pos* :  **string -\> pos:int -\> off:int -\> int**

*type normalize\_mode* =  **\[ \`ALL \| \`ALL\_COMPOSE \| \`DEFAULT \| \`DEFAULT\_COMPOSE \]**

*val normalize* :  **string -\> normalize\_mode -\> string**

*val uppercase* :  **string -\> string**

*val lowercase* :  **string -\> string**

*val casefold* :  **string -\> string**

*val collate* :  **string -\> string -\> int**

*val collate\_key* :  **string -\> string**
