---
name: "Glib.Convert"
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.Convert"
---

# Glib.Convert(3o)

Character Set Conversion

## NAME

Glib.Convert - Character Set Conversion

## Module

Module   Glib.Convert

## Documentation

Module **Convert**\
  :  **sig end**

Character Set Conversion

*type error* =\
  \| NO\_CONVERSION  (\* Conversion between the requested character sets is not supported \*)\
  \| ILLEGAL\_SEQUENCE  (\* Invalid byte sequence in conversion input \*)\
  \| FAILED  (\* Conversion failed for some reason \*)\
  \| PARTIAL\_INPUT  (\* Partial character sequence at end of input \*)\
  \| BAD\_URI  (\* URI is invalid \*)\
  \| NOT\_ABSOLUTE\_PATH  (\* Pathname is not an absolute path \*)

*exception Error* **of** **error \* string**

*val convert* :  **string -\> to\_codeset:string -\> from\_codeset:string -\> string**

**Raises Error** .

*val convert\_with\_fallback* :  **?fallback:string -\>** **to\_codeset:string -\> from\_codeset:string -\> string -\> string**

**Raises Error** .

**=== All internal strings are encoded in utf8: you should use** **the following conversion functions ===**

*val locale\_from\_utf8* :  **string -\> string**

Converts the input string from  **UTF-8** to the encoding of the current locale. If the locale's encoding is  **UTF-8** , the string is simply validated and returned unmodified.

**Raises**

**Error** if the conversion fails

**Error** if the string is not a valid  **UTF-8** string

*val locale\_to\_utf8* :  **string -\> string**

**Raises Error** .

**=== Converts the input string from the encoding of the current locale** **to UTF-8. If the locale's encoding is UTF-8, the string is** **simply validated and returned unmodified. ===**

*val filename\_from\_utf8* :  **string -\> string**

**Raises Error** .

*val filename\_to\_utf8* :  **string -\> string**

**Raises Error** .

*val filename\_from\_uri* :  **string -\> string option \* string**

**Raises Error** .

*val filename\_to\_uri* :  **?hostname:string -\> string -\> string**

**Raises Error** .

*val get\_charset* :  **unit -\> bool \* string**

Obtains the character set for the current locale.

**Returns** the pair  **u,s** where  **u** is true if the character set is **UTF-8** and  **s** is the character set name
