package lablgtk3

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Character Set Conversion @gtkdoc glib glib-Character-Set-Conversion

type error =
  1. | NO_CONVERSION
    (*

    Conversion between the requested character sets is not supported

    *)
  2. | ILLEGAL_SEQUENCE
    (*

    Invalid byte sequence in conversion input

    *)
  3. | FAILED
    (*

    Conversion failed for some reason

    *)
  4. | PARTIAL_INPUT
    (*

    Partial character sequence at end of input

    *)
  5. | BAD_URI
    (*

    URI is invalid

    *)
  6. | NOT_ABSOLUTE_PATH
    (*

    Pathname is not an absolute path

    *)
exception Error of error * string
val convert : string -> to_codeset:string -> from_codeset:string -> string
val convert_with_fallback : ?fallback:string -> to_codeset:string -> from_codeset:string -> string -> string

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

  • raises Error

    if the string is not a valid UTF-8 string

val locale_to_utf8 : string -> string
val filename_from_utf8 : string -> string
val filename_to_utf8 : string -> string
val filename_from_uri : string -> string option * string
val filename_to_uri : ?hostname:string -> string -> string
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

OCaml

Innovation. Community. Security.