<refentry id="glib-Unicode-Manipulation">
<refmeta>
<refentrytitle role="top_of_page" id="glib-Unicode-Manipulation.top_of_page">Unicode Manipulation</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GLIB Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Unicode Manipulation</refname>
<refpurpose>functions operating on Unicode characters and UTF-8 strings</refpurpose>
</refnamediv>

<refsynopsisdiv id="glib-Unicode-Manipulation.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;glib.h&gt;

typedef             <link linkend="gunichar">gunichar</link>;
typedef             <link linkend="gunichar2">gunichar2</link>;

<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-validate">g_unichar_validate</link>                  (<link linkend="gunichar">gunichar</link> ch);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-isalnum">g_unichar_isalnum</link>                   (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-isalpha">g_unichar_isalpha</link>                   (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-iscntrl">g_unichar_iscntrl</link>                   (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-isdefined">g_unichar_isdefined</link>                 (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-isdigit">g_unichar_isdigit</link>                   (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-isgraph">g_unichar_isgraph</link>                   (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-islower">g_unichar_islower</link>                   (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-ismark">g_unichar_ismark</link>                    (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-isprint">g_unichar_isprint</link>                   (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-ispunct">g_unichar_ispunct</link>                   (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-isspace">g_unichar_isspace</link>                   (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-istitle">g_unichar_istitle</link>                   (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-isupper">g_unichar_isupper</link>                   (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-isxdigit">g_unichar_isxdigit</link>                  (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-iswide">g_unichar_iswide</link>                    (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-iswide-cjk">g_unichar_iswide_cjk</link>                (<link linkend="gunichar">gunichar</link> c);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-iszerowidth">g_unichar_iszerowidth</link>               (<link linkend="gunichar">gunichar</link> c);
<link linkend="gunichar">gunichar</link>            <link linkend="g-unichar-toupper">g_unichar_toupper</link>                   (<link linkend="gunichar">gunichar</link> c);
<link linkend="gunichar">gunichar</link>            <link linkend="g-unichar-tolower">g_unichar_tolower</link>                   (<link linkend="gunichar">gunichar</link> c);
<link linkend="gunichar">gunichar</link>            <link linkend="g-unichar-totitle">g_unichar_totitle</link>                   (<link linkend="gunichar">gunichar</link> c);
<link linkend="gint">gint</link>                <link linkend="g-unichar-digit-value">g_unichar_digit_value</link>               (<link linkend="gunichar">gunichar</link> c);
<link linkend="gint">gint</link>                <link linkend="g-unichar-xdigit-value">g_unichar_xdigit_value</link>              (<link linkend="gunichar">gunichar</link> c);
enum                <link linkend="GUnicodeType">GUnicodeType</link>;
<link linkend="GUnicodeType">GUnicodeType</link>        <link linkend="g-unichar-type">g_unichar_type</link>                      (<link linkend="gunichar">gunichar</link> c);
enum                <link linkend="GUnicodeBreakType">GUnicodeBreakType</link>;
<link linkend="GUnicodeBreakType">GUnicodeBreakType</link>   <link linkend="g-unichar-break-type">g_unichar_break_type</link>                (<link linkend="gunichar">gunichar</link> c);
<link linkend="gint">gint</link>                <link linkend="g-unichar-combining-class">g_unichar_combining_class</link>           (<link linkend="gunichar">gunichar</link> uc);
<link linkend="void">void</link>                <link linkend="g-unicode-canonical-ordering">g_unicode_canonical_ordering</link>        (<link linkend="gunichar">gunichar</link> *string,
                                                         <link linkend="gsize">gsize</link> len);
<link linkend="gunichar">gunichar</link> *          <link linkend="g-unicode-canonical-decomposition">g_unicode_canonical_decomposition</link>   (<link linkend="gunichar">gunichar</link> ch,
                                                         <link linkend="gsize">gsize</link> *result_len);
<link linkend="gboolean">gboolean</link>            <link linkend="g-unichar-get-mirror-char">g_unichar_get_mirror_char</link>           (<link linkend="gunichar">gunichar</link> ch,
                                                         <link linkend="gunichar">gunichar</link> *mirrored_ch);
enum                <link linkend="GUnicodeScript">GUnicodeScript</link>;
<link linkend="GUnicodeScript">GUnicodeScript</link>      <link linkend="g-unichar-get-script">g_unichar_get_script</link>                (<link linkend="gunichar">gunichar</link> ch);

#define             <link linkend="g-utf8-next-char">g_utf8_next_char</link>                    (p)
<link linkend="gunichar">gunichar</link>            <link linkend="g-utf8-get-char">g_utf8_get_char</link>                     (const <link linkend="gchar">gchar</link> *p);
<link linkend="gunichar">gunichar</link>            <link linkend="g-utf8-get-char-validated">g_utf8_get_char_validated</link>           (const <link linkend="gchar">gchar</link> *p,
                                                         <link linkend="gssize">gssize</link> max_len);
<link linkend="gchar">gchar</link>*              <link linkend="g-utf8-offset-to-pointer">g_utf8_offset_to_pointer</link>            (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="glong">glong</link> offset);
<link linkend="glong">glong</link>               <link linkend="g-utf8-pointer-to-offset">g_utf8_pointer_to_offset</link>            (const <link linkend="gchar">gchar</link> *str,
                                                         const <link linkend="gchar">gchar</link> *pos);
<link linkend="gchar">gchar</link>*              <link linkend="g-utf8-prev-char">g_utf8_prev_char</link>                    (const <link linkend="gchar">gchar</link> *p);
<link linkend="gchar">gchar</link>*              <link linkend="g-utf8-find-next-char">g_utf8_find_next_char</link>               (const <link linkend="gchar">gchar</link> *p,
                                                         const <link linkend="gchar">gchar</link> *end);
<link linkend="gchar">gchar</link>*              <link linkend="g-utf8-find-prev-char">g_utf8_find_prev_char</link>               (const <link linkend="gchar">gchar</link> *str,
                                                         const <link linkend="gchar">gchar</link> *p);
<link linkend="glong">glong</link>               <link linkend="g-utf8-strlen">g_utf8_strlen</link>                       (const <link linkend="gchar">gchar</link> *p,
                                                         <link linkend="gssize">gssize</link> max);
<link linkend="gchar">gchar</link>*              <link linkend="g-utf8-strncpy">g_utf8_strncpy</link>                      (<link linkend="gchar">gchar</link> *dest,
                                                         const <link linkend="gchar">gchar</link> *src,
                                                         <link linkend="gsize">gsize</link> n);
<link linkend="gchar">gchar</link>*              <link linkend="g-utf8-strchr">g_utf8_strchr</link>                       (const <link linkend="gchar">gchar</link> *p,
                                                         <link linkend="gssize">gssize</link> len,
                                                         <link linkend="gunichar">gunichar</link> c);
<link linkend="gchar">gchar</link>*              <link linkend="g-utf8-strrchr">g_utf8_strrchr</link>                      (const <link linkend="gchar">gchar</link> *p,
                                                         <link linkend="gssize">gssize</link> len,
                                                         <link linkend="gunichar">gunichar</link> c);
<link linkend="gchar">gchar</link>*              <link linkend="g-utf8-strreverse">g_utf8_strreverse</link>                   (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> len);
<link linkend="gboolean">gboolean</link>            <link linkend="g-utf8-validate">g_utf8_validate</link>                     (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> max_len,
                                                         const <link linkend="gchar">gchar</link> **end);

<link linkend="gchar">gchar</link> *             <link linkend="g-utf8-strup">g_utf8_strup</link>                        (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> len);
<link linkend="gchar">gchar</link> *             <link linkend="g-utf8-strdown">g_utf8_strdown</link>                      (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> len);
<link linkend="gchar">gchar</link> *             <link linkend="g-utf8-casefold">g_utf8_casefold</link>                     (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> len);
<link linkend="gchar">gchar</link> *             <link linkend="g-utf8-normalize">g_utf8_normalize</link>                    (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> len,
                                                         <link linkend="GNormalizeMode">GNormalizeMode</link> mode);
enum                <link linkend="GNormalizeMode">GNormalizeMode</link>;
<link linkend="gint">gint</link>                <link linkend="g-utf8-collate">g_utf8_collate</link>                      (const <link linkend="gchar">gchar</link> *str1,
                                                         const <link linkend="gchar">gchar</link> *str2);
<link linkend="gchar">gchar</link> *             <link linkend="g-utf8-collate-key">g_utf8_collate_key</link>                  (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> len);
<link linkend="gchar">gchar</link> *             <link linkend="g-utf8-collate-key-for-filename">g_utf8_collate_key_for_filename</link>     (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> len);

<link linkend="gunichar2">gunichar2</link> *         <link linkend="g-utf8-to-utf16">g_utf8_to_utf16</link>                     (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="glong">glong</link> len,
                                                         <link linkend="glong">glong</link> *items_read,
                                                         <link linkend="glong">glong</link> *items_written,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="gunichar">gunichar</link> *          <link linkend="g-utf8-to-ucs4">g_utf8_to_ucs4</link>                      (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="glong">glong</link> len,
                                                         <link linkend="glong">glong</link> *items_read,
                                                         <link linkend="glong">glong</link> *items_written,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="gunichar">gunichar</link> *          <link linkend="g-utf8-to-ucs4-fast">g_utf8_to_ucs4_fast</link>                 (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="glong">glong</link> len,
                                                         <link linkend="glong">glong</link> *items_written);
<link linkend="gunichar">gunichar</link> *          <link linkend="g-utf16-to-ucs4">g_utf16_to_ucs4</link>                     (const <link linkend="gunichar2">gunichar2</link> *str,
                                                         <link linkend="glong">glong</link> len,
                                                         <link linkend="glong">glong</link> *items_read,
                                                         <link linkend="glong">glong</link> *items_written,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="gchar">gchar</link>*              <link linkend="g-utf16-to-utf8">g_utf16_to_utf8</link>                     (const <link linkend="gunichar2">gunichar2</link> *str,
                                                         <link linkend="glong">glong</link> len,
                                                         <link linkend="glong">glong</link> *items_read,
                                                         <link linkend="glong">glong</link> *items_written,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="gunichar2">gunichar2</link> *         <link linkend="g-ucs4-to-utf16">g_ucs4_to_utf16</link>                     (const <link linkend="gunichar">gunichar</link> *str,
                                                         <link linkend="glong">glong</link> len,
                                                         <link linkend="glong">glong</link> *items_read,
                                                         <link linkend="glong">glong</link> *items_written,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="gchar">gchar</link>*              <link linkend="g-ucs4-to-utf8">g_ucs4_to_utf8</link>                      (const <link linkend="gunichar">gunichar</link> *str,
                                                         <link linkend="glong">glong</link> len,
                                                         <link linkend="glong">glong</link> *items_read,
                                                         <link linkend="glong">glong</link> *items_written,
                                                         <link linkend="GError">GError</link> **error);
<link linkend="gint">gint</link>                <link linkend="g-unichar-to-utf8">g_unichar_to_utf8</link>                   (<link linkend="gunichar">gunichar</link> c,
                                                         <link linkend="gchar">gchar</link> *outbuf);
</synopsis>
</refsynopsisdiv>









<refsect1 id="glib-Unicode-Manipulation.description" role="desc">
<title role="desc.title">Description</title>
<para>
This section describes a number of functions for dealing with
Unicode characters and strings.  There are analogues of the
traditional <filename>ctype.h</filename> character classification
and case conversion functions, UTF-8 analogues of some string utility
functions, functions to perform normalization, case conversion and
collation on UTF-8 strings and finally functions to convert between
the UTF-8, UTF-16 and UCS-4 encodings of Unicode.
</para>
<para>
The implementations of the Unicode functions in GLib are based
on the Unicode Character Data tables, which are available from
<ulink url="http://www.unicode.org/">www.unicode.org</ulink>.
GLib 2.8 supports Unicode 4.0, GLib 2.10 supports Unicode 4.1,
GLib 2.12 supports Unicode 5.0, GLib 2.16.3 supports Unicode 5.1.
</para>
</refsect1>

<refsect1 id="glib-Unicode-Manipulation.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="gunichar" role="typedef">
<title>gunichar</title>
<indexterm zone="gunichar"><primary sortas="unichar">gunichar</primary></indexterm><programlisting>typedef guint32 gunichar;
</programlisting>
<para>
A type which can hold any UTF-32 or UCS-4 character code, also known
as a Unicode code point.
</para>
<para>
To print/scan values of this type to/from text you need to convert
to/from UTF-8, using <link linkend="g-utf32-to-utf8"><function>g_utf32_to_utf8()</function></link>/<link linkend="g-utf8-to-utf32"><function>g_utf8_to_utf32()</function></link>.
</para>
<para>
To print/scan values of this type as integer, use
<link linkend="G-GINT32-MODIFIER--CAPS"><literal>G_GINT32_MODIFIER</literal></link> and/or <link linkend="G-GUINT32-FORMAT--CAPS"><literal>G_GUINT32_FORMAT</literal></link>.
</para>
<para>
The notation to express a Unicode code point in running text is as a
hexadecimal number with four to six digits and uppercase letters, prefixed
by the string "U+".  Leading zeros are omitted, unless the code point would
have fewer than four hexadecimal digits.
For example, "U+0041 LATIN CAPITAL LETTER A".
To print a code point in the U+-notation, use the format string
"U+<link linkend="04--CAPS"><literal>04</literal></link>"G_GINT32_FORMAT"X".
To scan, use the format string "U+<link linkend="06--CAPS"><literal>06</literal></link>"G_GINT32_FORMAT"X".
<informalexample>
<programlisting>
gunichar c;
sscanf ("U+0041", "U+%06"G_GINT32_FORMAT"X", &amp;c)
g_print ("Read U+%04"G_GINT32_FORMAT"X", c);
</programlisting>
</informalexample>
</para></refsect2>
<refsect2 id="gunichar2" role="typedef">
<title>gunichar2</title>
<indexterm zone="gunichar2"><primary sortas="unichar2">gunichar2</primary></indexterm><programlisting>typedef guint16 gunichar2;
</programlisting>
<para>
A type which can hold any UTF-16 code
point<footnote id="utf16_surrogate_pairs">UTF-16 also has so called
<firstterm>surrogate pairs</firstterm> to encode characters beyond the
BMP as pairs of 16bit numbers. Surrogate pairs cannot be stored in a
single gunichar2 field, but all GLib functions accepting gunichar2 arrays
will correctly interpret surrogate pairs.</footnote>.
</para>
<para>
To print/scan values of this type to/from text you need to convert
to/from UTF-8, using <link linkend="g-utf16-to-utf8"><function>g_utf16_to_utf8()</function></link>/<link linkend="g-utf8-to-utf16"><function>g_utf8_to_utf16()</function></link>.
</para>
<para>
To print/scan values of this type as integer, use
<link linkend="G-GINT16-MODIFIER--CAPS"><literal>G_GINT16_MODIFIER</literal></link> and/or <link linkend="G-GUINT16-FORMAT--CAPS"><literal>G_GUINT16_FORMAT</literal></link>.
</para></refsect2>
<refsect2 id="g-unichar-validate" role="function">
<title>g_unichar_validate ()</title>
<indexterm zone="g-unichar-validate"><primary sortas="unichar_validate">g_unichar_validate</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_validate                  (<link linkend="gunichar">gunichar</link> ch);</programlisting>
<para>
Checks whether <parameter>ch</parameter> is a valid Unicode character. Some possible
integer values of <parameter>ch</parameter> will not be valid. 0 is considered a valid
character, though it's normally a string terminator.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>ch</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if <parameter>ch</parameter> is a valid Unicode character
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-isalnum" role="function">
<title>g_unichar_isalnum ()</title>
<indexterm zone="g-unichar-isalnum"><primary sortas="unichar_isalnum">g_unichar_isalnum</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_isalnum                   (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines whether a character is alphanumeric.
Given some UTF-8 text, obtain a character value
with <link linkend="g-utf8-get-char"><function>g_utf8_get_char()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if <parameter>c</parameter> is an alphanumeric character
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-isalpha" role="function">
<title>g_unichar_isalpha ()</title>
<indexterm zone="g-unichar-isalpha"><primary sortas="unichar_isalpha">g_unichar_isalpha</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_isalpha                   (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines whether a character is alphabetic (i.e. a letter).
Given some UTF-8 text, obtain a character value with
<link linkend="g-utf8-get-char"><function>g_utf8_get_char()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if <parameter>c</parameter> is an alphabetic character
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-iscntrl" role="function">
<title>g_unichar_iscntrl ()</title>
<indexterm zone="g-unichar-iscntrl"><primary sortas="unichar_iscntrl">g_unichar_iscntrl</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_iscntrl                   (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines whether a character is a control character.
Given some UTF-8 text, obtain a character value with
<link linkend="g-utf8-get-char"><function>g_utf8_get_char()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if <parameter>c</parameter> is a control character
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-isdefined" role="function">
<title>g_unichar_isdefined ()</title>
<indexterm zone="g-unichar-isdefined"><primary sortas="unichar_isdefined">g_unichar_isdefined</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_isdefined                 (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines if a given character is assigned in the Unicode
standard.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the character has an assigned value
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-isdigit" role="function">
<title>g_unichar_isdigit ()</title>
<indexterm zone="g-unichar-isdigit"><primary sortas="unichar_isdigit">g_unichar_isdigit</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_isdigit                   (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines whether a character is numeric (i.e. a digit).  This
covers ASCII 0-9 and also digits in other languages/scripts.  Given
some UTF-8 text, obtain a character value with <link linkend="g-utf8-get-char"><function>g_utf8_get_char()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if <parameter>c</parameter> is a digit
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-isgraph" role="function">
<title>g_unichar_isgraph ()</title>
<indexterm zone="g-unichar-isgraph"><primary sortas="unichar_isgraph">g_unichar_isgraph</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_isgraph                   (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines whether a character is printable and not a space
(returns <link linkend="FALSE--CAPS"><literal>FALSE</literal></link> for control characters, format characters, and
spaces). <link linkend="g-unichar-isprint"><function>g_unichar_isprint()</function></link> is similar, but returns <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> for
spaces. Given some UTF-8 text, obtain a character value with
<link linkend="g-utf8-get-char"><function>g_utf8_get_char()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if <parameter>c</parameter> is printable unless it's a space
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-islower" role="function">
<title>g_unichar_islower ()</title>
<indexterm zone="g-unichar-islower"><primary sortas="unichar_islower">g_unichar_islower</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_islower                   (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines whether a character is a lowercase letter.
Given some UTF-8 text, obtain a character value with
<link linkend="g-utf8-get-char"><function>g_utf8_get_char()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if <parameter>c</parameter> is a lowercase letter
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-ismark" role="function" condition="since:2.14">
<title>g_unichar_ismark ()</title>
<indexterm zone="g-unichar-ismark" role="2.14"><primary sortas="unichar_ismark">g_unichar_ismark</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_ismark                    (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines whether a character is a mark (non-spacing mark,
combining mark, or enclosing mark in Unicode speak).
Given some UTF-8 text, obtain a character value
with <link linkend="g-utf8-get-char"><function>g_utf8_get_char()</function></link>.
</para>
<para>
Note: in most cases where isalpha characters are allowed,
ismark characters should be allowed to as they are essential
for writing most European languages as well as many non-Latin
scripts.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if <parameter>c</parameter> is a mark character

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.14</para></refsect2>
<refsect2 id="g-unichar-isprint" role="function">
<title>g_unichar_isprint ()</title>
<indexterm zone="g-unichar-isprint"><primary sortas="unichar_isprint">g_unichar_isprint</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_isprint                   (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines whether a character is printable.
Unlike <link linkend="g-unichar-isgraph"><function>g_unichar_isgraph()</function></link>, returns <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> for spaces.
Given some UTF-8 text, obtain a character value with
<link linkend="g-utf8-get-char"><function>g_utf8_get_char()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if <parameter>c</parameter> is printable
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-ispunct" role="function">
<title>g_unichar_ispunct ()</title>
<indexterm zone="g-unichar-ispunct"><primary sortas="unichar_ispunct">g_unichar_ispunct</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_ispunct                   (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines whether a character is punctuation or a symbol.
Given some UTF-8 text, obtain a character value with
<link linkend="g-utf8-get-char"><function>g_utf8_get_char()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if <parameter>c</parameter> is a punctuation or symbol character
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-isspace" role="function">
<title>g_unichar_isspace ()</title>
<indexterm zone="g-unichar-isspace"><primary sortas="unichar_isspace">g_unichar_isspace</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_isspace                   (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines whether a character is a space, tab, or line separator
(newline, carriage return, etc.).  Given some UTF-8 text, obtain a
character value with <link linkend="g-utf8-get-char"><function>g_utf8_get_char()</function></link>.
</para>
<para>
(Note: don't use this to do word breaking; you have to use
Pango or equivalent to get word breaking right, the algorithm
is fairly complex.)</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if <parameter>c</parameter> is a space character
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-istitle" role="function">
<title>g_unichar_istitle ()</title>
<indexterm zone="g-unichar-istitle"><primary sortas="unichar_istitle">g_unichar_istitle</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_istitle                   (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines if a character is titlecase. Some characters in
Unicode which are composites, such as the DZ digraph
have three case variants instead of just two. The titlecase
form is used at the beginning of a word where only the
first letter is capitalized. The titlecase form of the DZ
digraph is U+01F2 LATIN CAPITAL LETTTER D WITH SMALL LETTER Z.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the character is titlecase
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-isupper" role="function">
<title>g_unichar_isupper ()</title>
<indexterm zone="g-unichar-isupper"><primary sortas="unichar_isupper">g_unichar_isupper</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_isupper                   (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines if a character is uppercase.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if <parameter>c</parameter> is an uppercase character
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-isxdigit" role="function">
<title>g_unichar_isxdigit ()</title>
<indexterm zone="g-unichar-isxdigit"><primary sortas="unichar_isxdigit">g_unichar_isxdigit</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_isxdigit                  (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines if a character is a hexidecimal digit.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the character is a hexadecimal digit
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-iswide" role="function">
<title>g_unichar_iswide ()</title>
<indexterm zone="g-unichar-iswide"><primary sortas="unichar_iswide">g_unichar_iswide</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_iswide                    (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines if a character is typically rendered in a double-width
cell.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the character is wide
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-iswide-cjk" role="function" condition="since:2.12">
<title>g_unichar_iswide_cjk ()</title>
<indexterm zone="g-unichar-iswide-cjk" role="2.12"><primary sortas="unichar_iswide_cjk">g_unichar_iswide_cjk</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_iswide_cjk                (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines if a character is typically rendered in a double-width
cell under legacy East Asian locales.  If a character is wide according to
<link linkend="g-unichar-iswide"><function>g_unichar_iswide()</function></link>, then it is also reported wide with this function, but
the converse is not necessarily true.  See the
<ulink url="http://www.unicode.org/reports/tr11/">Unicode Standard
Annex #11</ulink> for details.
</para>
<para>
If a character passes the <link linkend="g-unichar-iswide"><function>g_unichar_iswide()</function></link> test then it will also pass
this test, but not the other way around.  Note that some characters may
pas both this test and <link linkend="g-unichar-iszerowidth"><function>g_unichar_iszerowidth()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the character is wide in legacy East Asian locales

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.12</para></refsect2>
<refsect2 id="g-unichar-iszerowidth" role="function" condition="since:2.14">
<title>g_unichar_iszerowidth ()</title>
<indexterm zone="g-unichar-iszerowidth" role="2.14"><primary sortas="unichar_iszerowidth">g_unichar_iszerowidth</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_iszerowidth               (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines if a given character typically takes zero width when rendered.
The return value is <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> for all non-spacing and enclosing marks
(e.g., combining accents), format characters, zero-width
space, but not U+00AD SOFT HYPHEN.
</para>
<para>
A typical use of this function is with one of <link linkend="g-unichar-iswide"><function>g_unichar_iswide()</function></link> or
<link linkend="g-unichar-iswide-cjk"><function>g_unichar_iswide_cjk()</function></link> to determine the number of cells a string occupies
when displayed on a grid display (terminals).  However, note that not all
terminals support zero-width rendering of zero-width marks.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the character has zero width

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.14</para></refsect2>
<refsect2 id="g-unichar-toupper" role="function">
<title>g_unichar_toupper ()</title>
<indexterm zone="g-unichar-toupper"><primary sortas="unichar_toupper">g_unichar_toupper</primary></indexterm><programlisting><link linkend="gunichar">gunichar</link>            g_unichar_toupper                   (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Converts a character to uppercase.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the result of converting <parameter>c</parameter> to uppercase.
              If <parameter>c</parameter> is not an lowercase or titlecase character,
              or has no upper case equivalent <parameter>c</parameter> is returned unchanged.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-tolower" role="function">
<title>g_unichar_tolower ()</title>
<indexterm zone="g-unichar-tolower"><primary sortas="unichar_tolower">g_unichar_tolower</primary></indexterm><programlisting><link linkend="gunichar">gunichar</link>            g_unichar_tolower                   (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Converts a character to lower case.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the result of converting <parameter>c</parameter> to lower case.
              If <parameter>c</parameter> is not an upperlower or titlecase character,
              or has no lowercase equivalent <parameter>c</parameter> is returned unchanged.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-totitle" role="function">
<title>g_unichar_totitle ()</title>
<indexterm zone="g-unichar-totitle"><primary sortas="unichar_totitle">g_unichar_totitle</primary></indexterm><programlisting><link linkend="gunichar">gunichar</link>            g_unichar_totitle                   (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Converts a character to the titlecase.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the result of converting <parameter>c</parameter> to titlecase.
              If <parameter>c</parameter> is not an uppercase or lowercase character,
              <parameter>c</parameter> is returned unchanged.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-digit-value" role="function">
<title>g_unichar_digit_value ()</title>
<indexterm zone="g-unichar-digit-value"><primary sortas="unichar_digit_value">g_unichar_digit_value</primary></indexterm><programlisting><link linkend="gint">gint</link>                g_unichar_digit_value               (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines the numeric value of a character as a decimal
digit.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> If <parameter>c</parameter> is a decimal digit (according to
<link linkend="g-unichar-isdigit"><function>g_unichar_isdigit()</function></link>), its numeric value. Otherwise, -1.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-xdigit-value" role="function">
<title>g_unichar_xdigit_value ()</title>
<indexterm zone="g-unichar-xdigit-value"><primary sortas="unichar_xdigit_value">g_unichar_xdigit_value</primary></indexterm><programlisting><link linkend="gint">gint</link>                g_unichar_xdigit_value              (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines the numeric value of a character as a hexidecimal
digit.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> If <parameter>c</parameter> is a hex digit (according to
<link linkend="g-unichar-isxdigit"><function>g_unichar_isxdigit()</function></link>), its numeric value. Otherwise, -1.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="GUnicodeType" role="enum">
<title>enum GUnicodeType</title>
<indexterm zone="GUnicodeType"><primary sortas="UnicodeType">GUnicodeType</primary></indexterm><programlisting>typedef enum
{
  G_UNICODE_CONTROL,
  G_UNICODE_FORMAT,
  G_UNICODE_UNASSIGNED,
  G_UNICODE_PRIVATE_USE,
  G_UNICODE_SURROGATE,
  G_UNICODE_LOWERCASE_LETTER,
  G_UNICODE_MODIFIER_LETTER,
  G_UNICODE_OTHER_LETTER,
  G_UNICODE_TITLECASE_LETTER,
  G_UNICODE_UPPERCASE_LETTER,
  G_UNICODE_COMBINING_MARK,
  G_UNICODE_ENCLOSING_MARK,
  G_UNICODE_NON_SPACING_MARK,
  G_UNICODE_DECIMAL_NUMBER,
  G_UNICODE_LETTER_NUMBER,
  G_UNICODE_OTHER_NUMBER,
  G_UNICODE_CONNECT_PUNCTUATION,
  G_UNICODE_DASH_PUNCTUATION,
  G_UNICODE_CLOSE_PUNCTUATION,
  G_UNICODE_FINAL_PUNCTUATION,
  G_UNICODE_INITIAL_PUNCTUATION,
  G_UNICODE_OTHER_PUNCTUATION,
  G_UNICODE_OPEN_PUNCTUATION,
  G_UNICODE_CURRENCY_SYMBOL,
  G_UNICODE_MODIFIER_SYMBOL,
  G_UNICODE_MATH_SYMBOL,
  G_UNICODE_OTHER_SYMBOL,
  G_UNICODE_LINE_SEPARATOR,
  G_UNICODE_PARAGRAPH_SEPARATOR,
  G_UNICODE_SPACE_SEPARATOR
} GUnicodeType;
</programlisting>
<para>
These are the possible character classifications from the
Unicode specification.
See <ulink url="http://www.unicode.org/Public/UNIDATA/UnicodeData.html"
>http://www.unicode.org/Public/UNIDATA/UnicodeData.html</ulink>.
</para><variablelist role="enum">
<varlistentry id="G-UNICODE-CONTROL--CAPS" role="constant">
<term><literal>G_UNICODE_CONTROL</literal></term>
<listitem><simpara>General category "Other, Control" (Cc)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-FORMAT--CAPS" role="constant">
<term><literal>G_UNICODE_FORMAT</literal></term>
<listitem><simpara>General category "Other, Format" (Cf)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-UNASSIGNED--CAPS" role="constant">
<term><literal>G_UNICODE_UNASSIGNED</literal></term>
<listitem><simpara>General category "Other, Not Assigned" (Cn)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-PRIVATE-USE--CAPS" role="constant">
<term><literal>G_UNICODE_PRIVATE_USE</literal></term>
<listitem><simpara>General category "Other, Private Use" (Co)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SURROGATE--CAPS" role="constant">
<term><literal>G_UNICODE_SURROGATE</literal></term>
<listitem><simpara>General category "Other, Surrogate" (Cs)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-LOWERCASE-LETTER--CAPS" role="constant">
<term><literal>G_UNICODE_LOWERCASE_LETTER</literal></term>
<listitem><simpara>General category "Letter, Lowercase" (Ll)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-MODIFIER-LETTER--CAPS" role="constant">
<term><literal>G_UNICODE_MODIFIER_LETTER</literal></term>
<listitem><simpara>General category "Letter, Modifier" (Lm)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-OTHER-LETTER--CAPS" role="constant">
<term><literal>G_UNICODE_OTHER_LETTER</literal></term>
<listitem><simpara>General category "Letter, Other" (Lo)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-TITLECASE-LETTER--CAPS" role="constant">
<term><literal>G_UNICODE_TITLECASE_LETTER</literal></term>
<listitem><simpara>General category "Letter, Titlecase" (Lt)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-UPPERCASE-LETTER--CAPS" role="constant">
<term><literal>G_UNICODE_UPPERCASE_LETTER</literal></term>
<listitem><simpara>General category "Letter, Uppercase" (Lu)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-COMBINING-MARK--CAPS" role="constant">
<term><literal>G_UNICODE_COMBINING_MARK</literal></term>
<listitem><simpara>General category "Mark, Spacing Combining" (Mc)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-ENCLOSING-MARK--CAPS" role="constant">
<term><literal>G_UNICODE_ENCLOSING_MARK</literal></term>
<listitem><simpara>General category "Mark, Enclosing" (Me)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-NON-SPACING-MARK--CAPS" role="constant">
<term><literal>G_UNICODE_NON_SPACING_MARK</literal></term>
<listitem><simpara>General category "Mark, Nonspacing" (Mn)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-DECIMAL-NUMBER--CAPS" role="constant">
<term><literal>G_UNICODE_DECIMAL_NUMBER</literal></term>
<listitem><simpara>General category "Number, Decimal Digit" (Nd)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-LETTER-NUMBER--CAPS" role="constant">
<term><literal>G_UNICODE_LETTER_NUMBER</literal></term>
<listitem><simpara>General category "Number, Letter" (Nl)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-OTHER-NUMBER--CAPS" role="constant">
<term><literal>G_UNICODE_OTHER_NUMBER</literal></term>
<listitem><simpara>General category "Number, Other" (No)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-CONNECT-PUNCTUATION--CAPS" role="constant">
<term><literal>G_UNICODE_CONNECT_PUNCTUATION</literal></term>
<listitem><simpara>General category "Punctuation, Connector" (Pc)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-DASH-PUNCTUATION--CAPS" role="constant">
<term><literal>G_UNICODE_DASH_PUNCTUATION</literal></term>
<listitem><simpara>General category "Punctuation, Dash" (Pd)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-CLOSE-PUNCTUATION--CAPS" role="constant">
<term><literal>G_UNICODE_CLOSE_PUNCTUATION</literal></term>
<listitem><simpara>General category "Punctuation, Close" (Pe)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-FINAL-PUNCTUATION--CAPS" role="constant">
<term><literal>G_UNICODE_FINAL_PUNCTUATION</literal></term>
<listitem><simpara>General category "Punctuation, Final quote" (Pf)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-INITIAL-PUNCTUATION--CAPS" role="constant">
<term><literal>G_UNICODE_INITIAL_PUNCTUATION</literal></term>
<listitem><simpara>General category "Punctuation, Initial quote" (Pi)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-OTHER-PUNCTUATION--CAPS" role="constant">
<term><literal>G_UNICODE_OTHER_PUNCTUATION</literal></term>
<listitem><simpara>General category "Punctuation, Other" (Po)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-OPEN-PUNCTUATION--CAPS" role="constant">
<term><literal>G_UNICODE_OPEN_PUNCTUATION</literal></term>
<listitem><simpara>General category "Punctuation, Open" (Ps)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-CURRENCY-SYMBOL--CAPS" role="constant">
<term><literal>G_UNICODE_CURRENCY_SYMBOL</literal></term>
<listitem><simpara>General category "Symbol, Currency" (Sc)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-MODIFIER-SYMBOL--CAPS" role="constant">
<term><literal>G_UNICODE_MODIFIER_SYMBOL</literal></term>
<listitem><simpara>General category "Symbol, Modifier" (Sk)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-MATH-SYMBOL--CAPS" role="constant">
<term><literal>G_UNICODE_MATH_SYMBOL</literal></term>
<listitem><simpara>General category "Symbol, Math" (Sm)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-OTHER-SYMBOL--CAPS" role="constant">
<term><literal>G_UNICODE_OTHER_SYMBOL</literal></term>
<listitem><simpara>General category "Symbol, Other" (So)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-LINE-SEPARATOR--CAPS" role="constant">
<term><literal>G_UNICODE_LINE_SEPARATOR</literal></term>
<listitem><simpara>General category "Separator, Line" (Zl)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-PARAGRAPH-SEPARATOR--CAPS" role="constant">
<term><literal>G_UNICODE_PARAGRAPH_SEPARATOR</literal></term>
<listitem><simpara>General category "Separator, Paragraph" (Zp)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SPACE-SEPARATOR--CAPS" role="constant">
<term><literal>G_UNICODE_SPACE_SEPARATOR</literal></term>
<listitem><simpara>General category "Separator, Space" (Zs)
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-type" role="function">
<title>g_unichar_type ()</title>
<indexterm zone="g-unichar-type"><primary sortas="unichar_type">g_unichar_type</primary></indexterm><programlisting><link linkend="GUnicodeType">GUnicodeType</link>        g_unichar_type                      (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Classifies a Unicode character by type.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the type of the character.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="GUnicodeBreakType" role="enum">
<title>enum GUnicodeBreakType</title>
<indexterm zone="GUnicodeBreakType"><primary sortas="UnicodeBreakType">GUnicodeBreakType</primary></indexterm><programlisting>typedef enum
{
  G_UNICODE_BREAK_MANDATORY,
  G_UNICODE_BREAK_CARRIAGE_RETURN,
  G_UNICODE_BREAK_LINE_FEED,
  G_UNICODE_BREAK_COMBINING_MARK,
  G_UNICODE_BREAK_SURROGATE,
  G_UNICODE_BREAK_ZERO_WIDTH_SPACE,
  G_UNICODE_BREAK_INSEPARABLE,
  G_UNICODE_BREAK_NON_BREAKING_GLUE,
  G_UNICODE_BREAK_CONTINGENT,
  G_UNICODE_BREAK_SPACE,
  G_UNICODE_BREAK_AFTER,
  G_UNICODE_BREAK_BEFORE,
  G_UNICODE_BREAK_BEFORE_AND_AFTER,
  G_UNICODE_BREAK_HYPHEN,
  G_UNICODE_BREAK_NON_STARTER,
  G_UNICODE_BREAK_OPEN_PUNCTUATION,
  G_UNICODE_BREAK_CLOSE_PUNCTUATION,
  G_UNICODE_BREAK_QUOTATION,
  G_UNICODE_BREAK_EXCLAMATION,
  G_UNICODE_BREAK_IDEOGRAPHIC,
  G_UNICODE_BREAK_NUMERIC,
  G_UNICODE_BREAK_INFIX_SEPARATOR,
  G_UNICODE_BREAK_SYMBOL,
  G_UNICODE_BREAK_ALPHABETIC,
  G_UNICODE_BREAK_PREFIX,
  G_UNICODE_BREAK_POSTFIX,
  G_UNICODE_BREAK_COMPLEX_CONTEXT,
  G_UNICODE_BREAK_AMBIGUOUS,
  G_UNICODE_BREAK_UNKNOWN,
  G_UNICODE_BREAK_NEXT_LINE,
  G_UNICODE_BREAK_WORD_JOINER,
  G_UNICODE_BREAK_HANGUL_L_JAMO,
  G_UNICODE_BREAK_HANGUL_V_JAMO,
  G_UNICODE_BREAK_HANGUL_T_JAMO,
  G_UNICODE_BREAK_HANGUL_LV_SYLLABLE,
  G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE
} GUnicodeBreakType;
</programlisting>
<para>
These are the possible line break classifications.
The five Hangul types were added in Unicode 4.1, so, has been
introduced in GLib 2.10.  Note that new types may be added in the future.
Applications should be ready to handle unknown values.
They may be regarded as <link linkend="G-UNICODE-BREAK-UNKNOWN--CAPS"><literal>G_UNICODE_BREAK_UNKNOWN</literal></link>.
See <ulink url="http://www.unicode.org/unicode/reports/tr14/"
>http://www.unicode.org/unicode/reports/tr14/</ulink>.
</para><variablelist role="enum">
<varlistentry id="G-UNICODE-BREAK-MANDATORY--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_MANDATORY</literal></term>
<listitem><simpara>Mandatory Break (BK)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-CARRIAGE-RETURN--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_CARRIAGE_RETURN</literal></term>
<listitem><simpara>Carriage Return (CR)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-LINE-FEED--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_LINE_FEED</literal></term>
<listitem><simpara>Line Feed (LF)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-COMBINING-MARK--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_COMBINING_MARK</literal></term>
<listitem><simpara>Attached Characters and Combining Marks (CM)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-SURROGATE--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_SURROGATE</literal></term>
<listitem><simpara>Surrogates (SG)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-ZERO-WIDTH-SPACE--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_ZERO_WIDTH_SPACE</literal></term>
<listitem><simpara>Zero Width Space (ZW)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-INSEPARABLE--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_INSEPARABLE</literal></term>
<listitem><simpara>Inseparable (IN)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-NON-BREAKING-GLUE--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_NON_BREAKING_GLUE</literal></term>
<listitem><simpara>Non-breaking ("Glue") (GL)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-CONTINGENT--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_CONTINGENT</literal></term>
<listitem><simpara>Contingent Break Opportunity (CB)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-SPACE--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_SPACE</literal></term>
<listitem><simpara>Space (SP)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-AFTER--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_AFTER</literal></term>
<listitem><simpara>Break Opportunity After (BA)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-BEFORE--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_BEFORE</literal></term>
<listitem><simpara>Break Opportunity Before (BB)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-BEFORE-AND-AFTER--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_BEFORE_AND_AFTER</literal></term>
<listitem><simpara>Break Opportunity Before and After (B2)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-HYPHEN--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_HYPHEN</literal></term>
<listitem><simpara>Hyphen (HY)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-NON-STARTER--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_NON_STARTER</literal></term>
<listitem><simpara>Nonstarter (NS)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-OPEN-PUNCTUATION--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_OPEN_PUNCTUATION</literal></term>
<listitem><simpara>Opening Punctuation (OP)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-CLOSE-PUNCTUATION--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_CLOSE_PUNCTUATION</literal></term>
<listitem><simpara>Closing Punctuation (CL)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-QUOTATION--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_QUOTATION</literal></term>
<listitem><simpara>Ambiguous Quotation (QU)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-EXCLAMATION--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_EXCLAMATION</literal></term>
<listitem><simpara>Exclamation/Interrogation (EX)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-IDEOGRAPHIC--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_IDEOGRAPHIC</literal></term>
<listitem><simpara>Ideographic (ID)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-NUMERIC--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_NUMERIC</literal></term>
<listitem><simpara>Numeric (NU)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-INFIX-SEPARATOR--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_INFIX_SEPARATOR</literal></term>
<listitem><simpara>Infix Separator (Numeric) (IS)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-SYMBOL--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_SYMBOL</literal></term>
<listitem><simpara>Symbols Allowing Break After (SY)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-ALPHABETIC--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_ALPHABETIC</literal></term>
<listitem><simpara>Ordinary Alphabetic and Symbol Characters (AL)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-PREFIX--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_PREFIX</literal></term>
<listitem><simpara>Prefix (Numeric) (PR)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-POSTFIX--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_POSTFIX</literal></term>
<listitem><simpara>Postfix (Numeric) (PO)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-COMPLEX-CONTEXT--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_COMPLEX_CONTEXT</literal></term>
<listitem><simpara>Complex Content Dependent (South East Asian) (SA)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-AMBIGUOUS--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_AMBIGUOUS</literal></term>
<listitem><simpara>Ambiguous (Alphabetic or Ideographic) (AI)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-UNKNOWN--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_UNKNOWN</literal></term>
<listitem><simpara>Unknown (XX)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-NEXT-LINE--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_NEXT_LINE</literal></term>
<listitem><simpara>Next Line (NL)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-WORD-JOINER--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_WORD_JOINER</literal></term>
<listitem><simpara>Word Joiner (WJ)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-HANGUL-L-JAMO--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_HANGUL_L_JAMO</literal></term>
<listitem><simpara>Hangul L Jamo (JL)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-HANGUL-V-JAMO--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_HANGUL_V_JAMO</literal></term>
<listitem><simpara>Hangul V Jamo (JV)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-HANGUL-T-JAMO--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_HANGUL_T_JAMO</literal></term>
<listitem><simpara>Hangul T Jamo (JT)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-HANGUL-LV-SYLLABLE--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_HANGUL_LV_SYLLABLE</literal></term>
<listitem><simpara>Hangul LV Syllable (H2)
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-BREAK-HANGUL-LVT-SYLLABLE--CAPS" role="constant">
<term><literal>G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE</literal></term>
<listitem><simpara>Hangul LVT Syllable (H3)
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-break-type" role="function">
<title>g_unichar_break_type ()</title>
<indexterm zone="g-unichar-break-type"><primary sortas="unichar_break_type">g_unichar_break_type</primary></indexterm><programlisting><link linkend="GUnicodeBreakType">GUnicodeBreakType</link>   g_unichar_break_type                (<link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Determines the break type of <parameter>c</parameter>. <parameter>c</parameter> should be a Unicode character
(to derive a character from UTF-8 encoded text, use
<link linkend="g-utf8-get-char"><function>g_utf8_get_char()</function></link>). The break type is used to find word and line
breaks ("text boundaries"), Pango implements the Unicode boundary
resolution algorithms and normally you would use a function such
as <link linkend="pango-break"><function>pango_break()</function></link> instead of caring about break types yourself.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the break type of <parameter>c</parameter>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-combining-class" role="function" condition="since:2.14">
<title>g_unichar_combining_class ()</title>
<indexterm zone="g-unichar-combining-class" role="2.14"><primary sortas="unichar_combining_class">g_unichar_combining_class</primary></indexterm><programlisting><link linkend="gint">gint</link>                g_unichar_combining_class           (<link linkend="gunichar">gunichar</link> uc);</programlisting>
<para>
Determines the canonical combining class of a Unicode character.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>uc</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the combining class of the character

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.14</para></refsect2>
<refsect2 id="g-unicode-canonical-ordering" role="function">
<title>g_unicode_canonical_ordering ()</title>
<indexterm zone="g-unicode-canonical-ordering"><primary sortas="unicode_canonical_ordering">g_unicode_canonical_ordering</primary></indexterm><programlisting><link linkend="void">void</link>                g_unicode_canonical_ordering        (<link linkend="gunichar">gunichar</link> *string,
                                                         <link linkend="gsize">gsize</link> len);</programlisting>
<para>
Computes the canonical ordering of a string in-place.  
This rearranges decomposed characters in the string 
according to their combining classes.  See the Unicode 
manual for more information.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>string</parameter>&#160;:</term>
<listitem><simpara> a UCS-4 encoded string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> the maximum length of <parameter>string</parameter> to use.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unicode-canonical-decomposition" role="function">
<title>g_unicode_canonical_decomposition ()</title>
<indexterm zone="g-unicode-canonical-decomposition"><primary sortas="unicode_canonical_decomposition">g_unicode_canonical_decomposition</primary></indexterm><programlisting><link linkend="gunichar">gunichar</link> *          g_unicode_canonical_decomposition   (<link linkend="gunichar">gunichar</link> ch,
                                                         <link linkend="gsize">gsize</link> *result_len);</programlisting>
<para>
Computes the canonical decomposition of a Unicode character.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>ch</parameter>&#160;:</term>
<listitem><simpara> a Unicode character.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>result_len</parameter>&#160;:</term>
<listitem><simpara> location to store the length of the return value.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a newly allocated string of Unicode characters.
  <parameter>result_len</parameter> is set to the resulting length of the string.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-get-mirror-char" role="function" condition="since:2.4">
<title>g_unichar_get_mirror_char ()</title>
<indexterm zone="g-unichar-get-mirror-char" role="2.4"><primary sortas="unichar_get_mirror_char">g_unichar_get_mirror_char</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_unichar_get_mirror_char           (<link linkend="gunichar">gunichar</link> ch,
                                                         <link linkend="gunichar">gunichar</link> *mirrored_ch);</programlisting>
<para>
In Unicode, some characters are <firstterm>mirrored</firstterm>. This
means that their images are mirrored horizontally in text that is laid
out from right to left. For instance, "(" would become its mirror image,
")", in right-to-left text.
</para>
<para>
If <parameter>ch</parameter> has the Unicode mirrored property and there is another unicode
character that typically has a glyph that is the mirror image of <parameter>ch</parameter>'s
glyph and <parameter>mirrored_ch</parameter> is set, it puts that character in the address
pointed to by <parameter>mirrored_ch</parameter>.  Otherwise the original character is put.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>ch</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>mirrored_ch</parameter>&#160;:</term>
<listitem><simpara> location to store the mirrored character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if <parameter>ch</parameter> has a mirrored character, <link linkend="FALSE--CAPS"><literal>FALSE</literal></link> otherwise

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="GUnicodeScript" role="enum">
<title>enum GUnicodeScript</title>
<indexterm zone="GUnicodeScript"><primary sortas="UnicodeScript">GUnicodeScript</primary></indexterm><programlisting>typedef enum 
{                         /* ISO 15924 code */
  G_UNICODE_SCRIPT_INVALID_CODE = -1,
  G_UNICODE_SCRIPT_COMMON       = 0,   /* Zyyy */
  G_UNICODE_SCRIPT_INHERITED,          /* Qaai */
  G_UNICODE_SCRIPT_ARABIC,             /* Arab */
  G_UNICODE_SCRIPT_ARMENIAN,           /* Armn */
  G_UNICODE_SCRIPT_BENGALI,            /* Beng */
  G_UNICODE_SCRIPT_BOPOMOFO,           /* Bopo */
  G_UNICODE_SCRIPT_CHEROKEE,           /* Cher */
  G_UNICODE_SCRIPT_COPTIC,             /* Qaac */
  G_UNICODE_SCRIPT_CYRILLIC,           /* Cyrl (Cyrs) */
  G_UNICODE_SCRIPT_DESERET,            /* Dsrt */
  G_UNICODE_SCRIPT_DEVANAGARI,         /* Deva */
  G_UNICODE_SCRIPT_ETHIOPIC,           /* Ethi */
  G_UNICODE_SCRIPT_GEORGIAN,           /* Geor (Geon, Geoa) */
  G_UNICODE_SCRIPT_GOTHIC,             /* Goth */
  G_UNICODE_SCRIPT_GREEK,              /* Grek */
  G_UNICODE_SCRIPT_GUJARATI,           /* Gujr */
  G_UNICODE_SCRIPT_GURMUKHI,           /* Guru */
  G_UNICODE_SCRIPT_HAN,                /* Hani */
  G_UNICODE_SCRIPT_HANGUL,             /* Hang */
  G_UNICODE_SCRIPT_HEBREW,             /* Hebr */
  G_UNICODE_SCRIPT_HIRAGANA,           /* Hira */
  G_UNICODE_SCRIPT_KANNADA,            /* Knda */
  G_UNICODE_SCRIPT_KATAKANA,           /* Kana */
  G_UNICODE_SCRIPT_KHMER,              /* Khmr */
  G_UNICODE_SCRIPT_LAO,                /* Laoo */
  G_UNICODE_SCRIPT_LATIN,              /* Latn (Latf, Latg) */
  G_UNICODE_SCRIPT_MALAYALAM,          /* Mlym */
  G_UNICODE_SCRIPT_MONGOLIAN,          /* Mong */
  G_UNICODE_SCRIPT_MYANMAR,            /* Mymr */
  G_UNICODE_SCRIPT_OGHAM,              /* Ogam */
  G_UNICODE_SCRIPT_OLD_ITALIC,         /* Ital */
  G_UNICODE_SCRIPT_ORIYA,              /* Orya */
  G_UNICODE_SCRIPT_RUNIC,              /* Runr */
  G_UNICODE_SCRIPT_SINHALA,            /* Sinh */
  G_UNICODE_SCRIPT_SYRIAC,             /* Syrc (Syrj, Syrn, Syre) */
  G_UNICODE_SCRIPT_TAMIL,              /* Taml */
  G_UNICODE_SCRIPT_TELUGU,             /* Telu */
  G_UNICODE_SCRIPT_THAANA,             /* Thaa */
  G_UNICODE_SCRIPT_THAI,               /* Thai */
  G_UNICODE_SCRIPT_TIBETAN,            /* Tibt */
  G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL, /* Cans */
  G_UNICODE_SCRIPT_YI,                 /* Yiii */
  G_UNICODE_SCRIPT_TAGALOG,            /* Tglg */
  G_UNICODE_SCRIPT_HANUNOO,            /* Hano */
  G_UNICODE_SCRIPT_BUHID,              /* Buhd */
  G_UNICODE_SCRIPT_TAGBANWA,           /* Tagb */

  /* Unicode-4.0 additions */
  G_UNICODE_SCRIPT_BRAILLE,            /* Brai */
  G_UNICODE_SCRIPT_CYPRIOT,            /* Cprt */
  G_UNICODE_SCRIPT_LIMBU,              /* Limb */
  G_UNICODE_SCRIPT_OSMANYA,            /* Osma */
  G_UNICODE_SCRIPT_SHAVIAN,            /* Shaw */
  G_UNICODE_SCRIPT_LINEAR_B,           /* Linb */
  G_UNICODE_SCRIPT_TAI_LE,             /* Tale */
  G_UNICODE_SCRIPT_UGARITIC,           /* Ugar */
      
  /* Unicode-4.1 additions */
  G_UNICODE_SCRIPT_NEW_TAI_LUE,        /* Talu */
  G_UNICODE_SCRIPT_BUGINESE,           /* Bugi */
  G_UNICODE_SCRIPT_GLAGOLITIC,         /* Glag */
  G_UNICODE_SCRIPT_TIFINAGH,           /* Tfng */
  G_UNICODE_SCRIPT_SYLOTI_NAGRI,       /* Sylo */
  G_UNICODE_SCRIPT_OLD_PERSIAN,        /* Xpeo */
  G_UNICODE_SCRIPT_KHAROSHTHI,         /* Khar */

  /* Unicode-5.0 additions */
  G_UNICODE_SCRIPT_UNKNOWN,            /* Zzzz */
  G_UNICODE_SCRIPT_BALINESE,           /* Bali */
  G_UNICODE_SCRIPT_CUNEIFORM,          /* Xsux */
  G_UNICODE_SCRIPT_PHOENICIAN,         /* Phnx */
  G_UNICODE_SCRIPT_PHAGS_PA,           /* Phag */
  G_UNICODE_SCRIPT_NKO,                /* Nkoo */

  /* Unicode-5.1 additions */
  G_UNICODE_SCRIPT_KAYAH_LI,           /* Kali */
  G_UNICODE_SCRIPT_LEPCHA,             /* Lepc */
  G_UNICODE_SCRIPT_REJANG,             /* Rjng */
  G_UNICODE_SCRIPT_SUNDANESE,          /* Sund */
  G_UNICODE_SCRIPT_SAURASHTRA,         /* Saur */
  G_UNICODE_SCRIPT_CHAM,               /* Cham */
  G_UNICODE_SCRIPT_OL_CHIKI,           /* Olck */
  G_UNICODE_SCRIPT_VAI,                /* Vaii */
  G_UNICODE_SCRIPT_CARIAN,             /* Cari */
  G_UNICODE_SCRIPT_LYCIAN,             /* Lyci */
  G_UNICODE_SCRIPT_LYDIAN              /* Lydi */
} GUnicodeScript;
</programlisting>
<para>
The <link linkend="GUnicodeScript"><type>GUnicodeScript</type></link> enumeration identifies different writing
systems. The values correspond to the names as defined in the
Unicode standard. The enumeration has been added in GLib 2.14,
and is interchangeable with <link linkend="PangoScript"><type>PangoScript</type></link>.
Note that new types may be added in the future. Applications
should be ready to handle unknown values.
See <ulink
url="http://www.unicode.org/reports/tr24/">Unicode Standard Annex
#24: Script names</ulink>.
</para><variablelist role="enum">
<varlistentry id="G-UNICODE-SCRIPT-INVALID-CODE--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_INVALID_CODE</literal></term>
<listitem><simpara>a value never returned from <link linkend="g-unichar-get-script"><function>g_unichar_get_script()</function></link>
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-COMMON--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_COMMON</literal></term>
<listitem><simpara>    a character used by multiple different scripts
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-INHERITED--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_INHERITED</literal></term>
<listitem><simpara> a mark glyph that takes its script from the
                              base glyph to which it is attached
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-ARABIC--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_ARABIC</literal></term>
<listitem><simpara>    Arabic
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-ARMENIAN--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_ARMENIAN</literal></term>
<listitem><simpara>  Armenian
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-BENGALI--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_BENGALI</literal></term>
<listitem><simpara>   Bengali
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-BOPOMOFO--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_BOPOMOFO</literal></term>
<listitem><simpara>  Bopomofo
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-CHEROKEE--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_CHEROKEE</literal></term>
<listitem><simpara>  Cherokee
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-COPTIC--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_COPTIC</literal></term>
<listitem><simpara>    Coptic
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-CYRILLIC--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_CYRILLIC</literal></term>
<listitem><simpara>  Cyrillic
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-DESERET--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_DESERET</literal></term>
<listitem><simpara>   Deseret
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-DEVANAGARI--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_DEVANAGARI</literal></term>
<listitem><simpara>Devanagari
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-ETHIOPIC--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_ETHIOPIC</literal></term>
<listitem><simpara>  Ethiopic
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-GEORGIAN--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_GEORGIAN</literal></term>
<listitem><simpara>  Georgian
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-GOTHIC--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_GOTHIC</literal></term>
<listitem><simpara>    Gothic
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-GREEK--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_GREEK</literal></term>
<listitem><simpara>     Greek
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-GUJARATI--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_GUJARATI</literal></term>
<listitem><simpara>  Gujarati
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-GURMUKHI--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_GURMUKHI</literal></term>
<listitem><simpara>  Gurmukhi
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-HAN--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_HAN</literal></term>
<listitem><simpara>       Han
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-HANGUL--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_HANGUL</literal></term>
<listitem><simpara>    Hangul
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-HEBREW--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_HEBREW</literal></term>
<listitem><simpara>    Hebrew
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-HIRAGANA--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_HIRAGANA</literal></term>
<listitem><simpara>  Hiragana
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-KANNADA--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_KANNADA</literal></term>
<listitem><simpara>   Kannada
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-KATAKANA--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_KATAKANA</literal></term>
<listitem><simpara>  Katakana
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-KHMER--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_KHMER</literal></term>
<listitem><simpara>     Khmer
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-LAO--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_LAO</literal></term>
<listitem><simpara>       Lao
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-LATIN--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_LATIN</literal></term>
<listitem><simpara>     Latin
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-MALAYALAM--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_MALAYALAM</literal></term>
<listitem><simpara> Malayalam
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-MONGOLIAN--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_MONGOLIAN</literal></term>
<listitem><simpara> Mongolian
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-MYANMAR--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_MYANMAR</literal></term>
<listitem><simpara>   Myanmar
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-OGHAM--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_OGHAM</literal></term>
<listitem><simpara>     Ogham
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-OLD-ITALIC--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_OLD_ITALIC</literal></term>
<listitem><simpara>Old Italic
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-ORIYA--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_ORIYA</literal></term>
<listitem><simpara>     Oriya
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-RUNIC--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_RUNIC</literal></term>
<listitem><simpara>     Runic
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-SINHALA--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_SINHALA</literal></term>
<listitem><simpara>   Sinhala
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-SYRIAC--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_SYRIAC</literal></term>
<listitem><simpara>    Syriac
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-TAMIL--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_TAMIL</literal></term>
<listitem><simpara>     Tamil
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-TELUGU--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_TELUGU</literal></term>
<listitem><simpara>    Telugu
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-THAANA--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_THAANA</literal></term>
<listitem><simpara>    Thaana
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-THAI--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_THAI</literal></term>
<listitem><simpara>      Thai
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-TIBETAN--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_TIBETAN</literal></term>
<listitem><simpara>   Tibetan
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-CANADIAN-ABORIGINAL--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL</literal></term>
<listitem><simpara>
                              Canadian Aboriginal
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-YI--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_YI</literal></term>
<listitem><simpara>        Yi
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-TAGALOG--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_TAGALOG</literal></term>
<listitem><simpara>   Tagalog
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-HANUNOO--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_HANUNOO</literal></term>
<listitem><simpara>   Hanunoo
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-BUHID--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_BUHID</literal></term>
<listitem><simpara>     Buhid
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-TAGBANWA--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_TAGBANWA</literal></term>
<listitem><simpara>  Tagbanwa
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-BRAILLE--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_BRAILLE</literal></term>
<listitem><simpara>   Braille
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-CYPRIOT--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_CYPRIOT</literal></term>
<listitem><simpara>   Cypriot
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-LIMBU--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_LIMBU</literal></term>
<listitem><simpara>     Limbu
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-OSMANYA--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_OSMANYA</literal></term>
<listitem><simpara>   Osmanya
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-SHAVIAN--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_SHAVIAN</literal></term>
<listitem><simpara>   Shavian
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-LINEAR-B--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_LINEAR_B</literal></term>
<listitem><simpara>  Linear B
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-TAI-LE--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_TAI_LE</literal></term>
<listitem><simpara>    Tai Le
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-UGARITIC--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_UGARITIC</literal></term>
<listitem><simpara>  Ugaritic
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-NEW-TAI-LUE--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_NEW_TAI_LUE</literal></term>
<listitem><simpara>New Tai Lue
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-BUGINESE--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_BUGINESE</literal></term>
<listitem><simpara>  Buginese
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-GLAGOLITIC--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_GLAGOLITIC</literal></term>
<listitem><simpara>Glagolitic
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-TIFINAGH--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_TIFINAGH</literal></term>
<listitem><simpara>  Tifinagh
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-SYLOTI-NAGRI--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_SYLOTI_NAGRI</literal></term>
<listitem><simpara>Syloti Nagri
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-OLD-PERSIAN--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_OLD_PERSIAN</literal></term>
<listitem><simpara>Old Persian
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-KHAROSHTHI--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_KHAROSHTHI</literal></term>
<listitem><simpara>Kharoshthi
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-UNKNOWN--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_UNKNOWN</literal></term>
<listitem><simpara>   an unassigned code point
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-BALINESE--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_BALINESE</literal></term>
<listitem><simpara>  Balinese
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-CUNEIFORM--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_CUNEIFORM</literal></term>
<listitem><simpara> Cuneiform
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-PHOENICIAN--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_PHOENICIAN</literal></term>
<listitem><simpara>Phoenician
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-PHAGS-PA--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_PHAGS_PA</literal></term>
<listitem><simpara>  Phags-pa
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-NKO--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_NKO</literal></term>
<listitem><simpara>       N'Ko
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-KAYAH-LI--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_KAYAH_LI</literal></term>
<listitem><simpara>  Kayah Li. Since 2.16.3
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-LEPCHA--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_LEPCHA</literal></term>
<listitem><simpara>    Lepcha. Since 2.16.3
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-REJANG--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_REJANG</literal></term>
<listitem><simpara>    Rejang. Since 2.16.3
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-SUNDANESE--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_SUNDANESE</literal></term>
<listitem><simpara> Sundanese. Since 2.16.3
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-SAURASHTRA--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_SAURASHTRA</literal></term>
<listitem><simpara>Saurashtra. Since 2.16.3
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-CHAM--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_CHAM</literal></term>
<listitem><simpara>      Cham. Since 2.16.3
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-OL-CHIKI--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_OL_CHIKI</literal></term>
<listitem><simpara>  Ol Chiki. Since 2.16.3
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-VAI--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_VAI</literal></term>
<listitem><simpara>       Vai. Since 2.16.3
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-CARIAN--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_CARIAN</literal></term>
<listitem><simpara>    Carian. Since 2.16.3
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-LYCIAN--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_LYCIAN</literal></term>
<listitem><simpara>    Lycian. Since 2.16.3
</simpara></listitem>
</varlistentry>
<varlistentry id="G-UNICODE-SCRIPT-LYDIAN--CAPS" role="constant">
<term><literal>G_UNICODE_SCRIPT_LYDIAN</literal></term>
<listitem><simpara>    Lydian. Since 2.16.3
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-get-script" role="function" condition="since:2.14">
<title>g_unichar_get_script ()</title>
<indexterm zone="g-unichar-get-script" role="2.14"><primary sortas="unichar_get_script">g_unichar_get_script</primary></indexterm><programlisting><link linkend="GUnicodeScript">GUnicodeScript</link>      g_unichar_get_script                (<link linkend="gunichar">gunichar</link> ch);</programlisting>
<para>
Looks up the <link linkend="GUnicodeScript"><type>GUnicodeScript</type></link> for a particular character (as defined 
by Unicode Standard Annex <link linkend="24--CAPS"><type>24</type></link>). No check is made for <parameter>ch</parameter> being a
valid Unicode character; if you pass in invalid character, the
result is undefined.
</para>
<para>
This function is equivalent to <link linkend="pango-script-for-unichar"><function>pango_script_for_unichar()</function></link> and the
two are interchangeable.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>ch</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the <link linkend="GUnicodeScript"><type>GUnicodeScript</type></link> for the character.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.14</para></refsect2>
<refsect2 id="g-utf8-next-char" role="macro">
<title>g_utf8_next_char()</title>
<indexterm zone="g-utf8-next-char"><primary sortas="utf8_next_char">g_utf8_next_char</primary></indexterm><programlisting>#define             g_utf8_next_char(p)</programlisting>
<para>
Skips to the next character in a UTF-8 string. The string must be
valid; this macro is as fast as possible, and has no error-checking.
You would use this macro to iterate over a string character by
character. The macro returns the start of the next UTF-8 character.
Before using this macro, use <link linkend="g-utf8-validate"><function>g_utf8_validate()</function></link> to validate strings
that may contain invalid UTF-8.
</para><variablelist role="params">
<varlistentry><term><parameter>p</parameter>&#160;:</term>
<listitem><simpara>Pointer to the start of a valid UTF-8 character.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-get-char" role="function">
<title>g_utf8_get_char ()</title>
<indexterm zone="g-utf8-get-char"><primary sortas="utf8_get_char">g_utf8_get_char</primary></indexterm><programlisting><link linkend="gunichar">gunichar</link>            g_utf8_get_char                     (const <link linkend="gchar">gchar</link> *p);</programlisting>
<para>
Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
If <parameter>p</parameter> does not point to a valid UTF-8 encoded character, results are
undefined. If you are not sure that the bytes are complete
valid Unicode characters, you should use <link linkend="g-utf8-get-char-validated"><function>g_utf8_get_char_validated()</function></link>
instead.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>p</parameter>&#160;:</term>
<listitem><simpara> a pointer to Unicode character encoded as UTF-8
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the resulting character
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-get-char-validated" role="function">
<title>g_utf8_get_char_validated ()</title>
<indexterm zone="g-utf8-get-char-validated"><primary sortas="utf8_get_char_validated">g_utf8_get_char_validated</primary></indexterm><programlisting><link linkend="gunichar">gunichar</link>            g_utf8_get_char_validated           (const <link linkend="gchar">gchar</link> *p,
                                                         <link linkend="gssize">gssize</link> max_len);</programlisting>
<para>
Convert a sequence of bytes encoded as UTF-8 to a Unicode character.
This function checks for incomplete characters, for invalid characters
such as characters that are out of the range of Unicode, and for
overlong encodings of valid characters.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>p</parameter>&#160;:</term>
<listitem><simpara> a pointer to Unicode character encoded as UTF-8
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>max_len</parameter>&#160;:</term>
<listitem><simpara> the maximum number of bytes to read, or -1, for no maximum or
          if <parameter>p</parameter> is nul-terminated
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the resulting character. If <parameter>p</parameter> points to a partial
   sequence at the end of a string that could begin a valid 
   character (or if <parameter>max_len</parameter> is zero), returns (gunichar)-2; 
   otherwise, if <parameter>p</parameter> does not point to a valid UTF-8 encoded 
   Unicode character, returns (gunichar)-1.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-offset-to-pointer" role="function">
<title>g_utf8_offset_to_pointer ()</title>
<indexterm zone="g-utf8-offset-to-pointer"><primary sortas="utf8_offset_to_pointer">g_utf8_offset_to_pointer</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*              g_utf8_offset_to_pointer            (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="glong">glong</link> offset);</programlisting>
<para>
Converts from an integer character offset to a pointer to a position
within the string.
</para>
<para>
Since 2.10, this function allows to pass a negative <parameter>offset</parameter> to
step backwards. It is usually worth stepping backwards from the end
instead of forwards if <parameter>offset</parameter> is in the last fourth of the string,
since moving forward is about 3 times faster than moving backward.
</para>
<para>
<note><para>
This function doesn't abort when reaching the end of <parameter>str</parameter>. Therefore
you should be sure that <parameter>offset</parameter> is within string boundaries before
calling that function. Call <link linkend="g-utf8-strlen"><function>g_utf8_strlen()</function></link> when unsure.
</para>
<para>
This limitation exists as this function is called frequently during
text rendering and therefore has to be as fast as possible.
</para></note></para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>offset</parameter>&#160;:</term>
<listitem><simpara> a character offset within <parameter>str</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the resulting pointer
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-pointer-to-offset" role="function">
<title>g_utf8_pointer_to_offset ()</title>
<indexterm zone="g-utf8-pointer-to-offset"><primary sortas="utf8_pointer_to_offset">g_utf8_pointer_to_offset</primary></indexterm><programlisting><link linkend="glong">glong</link>               g_utf8_pointer_to_offset            (const <link linkend="gchar">gchar</link> *str,
                                                         const <link linkend="gchar">gchar</link> *pos);</programlisting>
<para>
Converts from a pointer to position within a string to a integer
character offset.
</para>
<para>
Since 2.10, this function allows <parameter>pos</parameter> to be before <parameter>str</parameter>, and returns
a negative offset in this case.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pos</parameter>&#160;:</term>
<listitem><simpara> a pointer to a position within <parameter>str</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the resulting character offset
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-prev-char" role="function">
<title>g_utf8_prev_char ()</title>
<indexterm zone="g-utf8-prev-char"><primary sortas="utf8_prev_char">g_utf8_prev_char</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*              g_utf8_prev_char                    (const <link linkend="gchar">gchar</link> *p);</programlisting>
<para>
Finds the previous UTF-8 character in the string before <parameter>p</parameter>.
</para>
<para>
<parameter>p</parameter> does not have to be at the beginning of a UTF-8 character. No check
is made to see if the character found is actually valid other than
it starts with an appropriate byte. If <parameter>p</parameter> might be the first
character of the string, you must use <link linkend="g-utf8-find-prev-char"><function>g_utf8_find_prev_char()</function></link> instead.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>p</parameter>&#160;:</term>
<listitem><simpara> a pointer to a position within a UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a pointer to the found character.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-find-next-char" role="function">
<title>g_utf8_find_next_char ()</title>
<indexterm zone="g-utf8-find-next-char"><primary sortas="utf8_find_next_char">g_utf8_find_next_char</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*              g_utf8_find_next_char               (const <link linkend="gchar">gchar</link> *p,
                                                         const <link linkend="gchar">gchar</link> *end);</programlisting>
<para>
Finds the start of the next UTF-8 character in the string after <parameter>p</parameter>.
</para>
<para>
<parameter>p</parameter> does not have to be at the beginning of a UTF-8 character. No check
is made to see if the character found is actually valid other than
it starts with an appropriate byte.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>p</parameter>&#160;:</term>
<listitem><simpara> a pointer to a position within a UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>end</parameter>&#160;:</term>
<listitem><simpara> a pointer to the byte following the end of the string,
or <link linkend="NULL--CAPS"><literal>NULL</literal></link> to indicate that the string is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a pointer to the found character or <link linkend="NULL--CAPS"><literal>NULL</literal></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-find-prev-char" role="function">
<title>g_utf8_find_prev_char ()</title>
<indexterm zone="g-utf8-find-prev-char"><primary sortas="utf8_find_prev_char">g_utf8_find_prev_char</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*              g_utf8_find_prev_char               (const <link linkend="gchar">gchar</link> *str,
                                                         const <link linkend="gchar">gchar</link> *p);</programlisting>
<para>
Given a position <parameter>p</parameter> with a UTF-8 encoded string <parameter>str</parameter>, find the start
of the previous UTF-8 character starting before <parameter>p</parameter>. Returns <link linkend="NULL--CAPS"><literal>NULL</literal></link> if no
UTF-8 characters are present in <parameter>str</parameter> before <parameter>p</parameter>.
</para>
<para>
<parameter>p</parameter> does not have to be at the beginning of a UTF-8 character. No check
is made to see if the character found is actually valid other than
it starts with an appropriate byte.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> pointer to the beginning of a UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>p</parameter>&#160;:</term>
<listitem><simpara> pointer to some position within <parameter>str</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a pointer to the found character or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-strlen" role="function">
<title>g_utf8_strlen ()</title>
<indexterm zone="g-utf8-strlen"><primary sortas="utf8_strlen">g_utf8_strlen</primary></indexterm><programlisting><link linkend="glong">glong</link>               g_utf8_strlen                       (const <link linkend="gchar">gchar</link> *p,
                                                         <link linkend="gssize">gssize</link> max);</programlisting>
<para>
Returns the length of the string in characters.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>p</parameter>&#160;:</term>
<listitem><simpara> pointer to the start of a UTF-8 encoded string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>max</parameter>&#160;:</term>
<listitem><simpara> the maximum number of bytes to examine. If <parameter>max</parameter>
      is less than 0, then the string is assumed to be
      nul-terminated. If <parameter>max</parameter> is 0, <parameter>p</parameter> will not be examined and 
      may be <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the length of the string in characters
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-strncpy" role="function">
<title>g_utf8_strncpy ()</title>
<indexterm zone="g-utf8-strncpy"><primary sortas="utf8_strncpy">g_utf8_strncpy</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*              g_utf8_strncpy                      (<link linkend="gchar">gchar</link> *dest,
                                                         const <link linkend="gchar">gchar</link> *src,
                                                         <link linkend="gsize">gsize</link> n);</programlisting>
<para>
Like the standard C <link linkend="strncpy"><function>strncpy()</function></link> function, but 
copies a given number of characters instead of a given number of 
bytes. The <parameter>src</parameter> string must be valid UTF-8 encoded text. 
(Use <link linkend="g-utf8-validate"><function>g_utf8_validate()</function></link> on all text before trying to use UTF-8 
utility functions with it.)</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>dest</parameter>&#160;:</term>
<listitem><simpara> buffer to fill with characters from <parameter>src</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>src</parameter>&#160;:</term>
<listitem><simpara> UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n</parameter>&#160;:</term>
<listitem><simpara> character count
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <parameter>dest</parameter>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-strchr" role="function">
<title>g_utf8_strchr ()</title>
<indexterm zone="g-utf8-strchr"><primary sortas="utf8_strchr">g_utf8_strchr</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*              g_utf8_strchr                       (const <link linkend="gchar">gchar</link> *p,
                                                         <link linkend="gssize">gssize</link> len,
                                                         <link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Finds the leftmost occurrence of the given Unicode character
in a UTF-8 encoded string, while limiting the search to <parameter>len</parameter> bytes.
If <parameter>len</parameter> is -1, allow unbounded search.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>p</parameter>&#160;:</term>
<listitem><simpara> a nul-terminated UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> the maximum length of <parameter>p</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the string does not contain the character, 
  otherwise, a pointer to the start of the leftmost occurrence of 
  the character in the string.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-strrchr" role="function">
<title>g_utf8_strrchr ()</title>
<indexterm zone="g-utf8-strrchr"><primary sortas="utf8_strrchr">g_utf8_strrchr</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*              g_utf8_strrchr                      (const <link linkend="gchar">gchar</link> *p,
                                                         <link linkend="gssize">gssize</link> len,
                                                         <link linkend="gunichar">gunichar</link> c);</programlisting>
<para>
Find the rightmost occurrence of the given Unicode character
in a UTF-8 encoded string, while limiting the search to <parameter>len</parameter> bytes.
If <parameter>len</parameter> is -1, allow unbounded search.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>p</parameter>&#160;:</term>
<listitem><simpara> a nul-terminated UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> the maximum length of <parameter>p</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the string does not contain the character, 
  otherwise, a pointer to the start of the rightmost occurrence of the 
  character in the string.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-strreverse" role="function" condition="since:2.2">
<title>g_utf8_strreverse ()</title>
<indexterm zone="g-utf8-strreverse" role="2.2"><primary sortas="utf8_strreverse">g_utf8_strreverse</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*              g_utf8_strreverse                   (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> len);</programlisting>
<para>
Reverses a UTF-8 string. <parameter>str</parameter> must be valid UTF-8 encoded text. 
(Use <link linkend="g-utf8-validate"><function>g_utf8_validate()</function></link> on all text before trying to use UTF-8 
utility functions with it.)
</para>
<para>
This function is intended for programmatic uses of reversed strings.
It pays no attention to decomposed characters, combining marks, byte 
order marks, directional indicators (LRM, LRO, etc) and similar 
characters which might need special handling when reversing a string 
for display purposes.
</para>
<para>
Note that unlike <link linkend="g-strreverse"><function>g_strreverse()</function></link>, this function returns
newly-allocated memory, which should be freed with <link linkend="g-free"><function>g_free()</function></link> when
no longer needed.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> the maximum length of <parameter>str</parameter> to use, in bytes. If <parameter>len</parameter> &lt; 0,
      then the string is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a newly-allocated string which is the reverse of <parameter>str</parameter>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.2</para></refsect2>
<refsect2 id="g-utf8-validate" role="function">
<title>g_utf8_validate ()</title>
<indexterm zone="g-utf8-validate"><primary sortas="utf8_validate">g_utf8_validate</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_utf8_validate                     (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> max_len,
                                                         const <link linkend="gchar">gchar</link> **end);</programlisting>
<para>
Validates UTF-8 encoded text. <parameter>str</parameter> is the text to validate;
if <parameter>str</parameter> is nul-terminated, then <parameter>max_len</parameter> can be -1, otherwise
<parameter>max_len</parameter> should be the number of bytes to validate.
If <parameter>end</parameter> is non-<link linkend="NULL--CAPS"><literal>NULL</literal></link>, then the end of the valid range
will be stored there (i.e. the start of the first invalid 
character if some bytes were invalid, or the end of the text 
being validated otherwise).
</para>
<para>
Note that <link linkend="g-utf8-validate"><function>g_utf8_validate()</function></link> returns <link linkend="FALSE--CAPS"><literal>FALSE</literal></link> if <parameter>max_len</parameter> is 
positive and NUL is met before <parameter>max_len</parameter> bytes have been read.
</para>
<para>
Returns <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if all of <parameter>str</parameter> was valid. Many GLib and GTK+
routines <emphasis>require</emphasis> valid UTF-8 as input;
so data read from a file or the network should be checked
with <link linkend="g-utf8-validate"><function>g_utf8_validate()</function></link> before doing anything else with it.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a pointer to character data
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>max_len</parameter>&#160;:</term>
<listitem><simpara> max bytes to validate, or -1 to go until NUL
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>end</parameter>&#160;:</term>
<listitem><simpara> return location for end of valid data
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the text was valid UTF-8
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-strup" role="function">
<title>g_utf8_strup ()</title>
<indexterm zone="g-utf8-strup"><primary sortas="utf8_strup">g_utf8_strup</primary></indexterm><programlisting><link linkend="gchar">gchar</link> *             g_utf8_strup                        (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> len);</programlisting>
<para>
Converts all Unicode characters in the string that have a case
to uppercase. The exact manner that this is done depends
on the current locale, and may result in the number of
characters in the string increasing. (For instance, the
German ess-zet will be changed to SS.)</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> length of <parameter>str</parameter>, in bytes, or -1 if <parameter>str</parameter> is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a newly allocated string, with all characters
   converted to uppercase.  
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-strdown" role="function">
<title>g_utf8_strdown ()</title>
<indexterm zone="g-utf8-strdown"><primary sortas="utf8_strdown">g_utf8_strdown</primary></indexterm><programlisting><link linkend="gchar">gchar</link> *             g_utf8_strdown                      (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> len);</programlisting>
<para>
Converts all Unicode characters in the string that have a case
to lowercase. The exact manner that this is done depends
on the current locale, and may result in the number of
characters in the string changing.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> length of <parameter>str</parameter>, in bytes, or -1 if <parameter>str</parameter> is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a newly allocated string, with all characters
   converted to lowercase.  
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-casefold" role="function">
<title>g_utf8_casefold ()</title>
<indexterm zone="g-utf8-casefold"><primary sortas="utf8_casefold">g_utf8_casefold</primary></indexterm><programlisting><link linkend="gchar">gchar</link> *             g_utf8_casefold                     (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> len);</programlisting>
<para>
Converts a string into a form that is independent of case. The
result will not correspond to any particular case, but can be
compared for equality or ordered with the results of calling
<link linkend="g-utf8-casefold"><function>g_utf8_casefold()</function></link> on other strings.
</para>
<para>
Note that calling <link linkend="g-utf8-casefold"><function>g_utf8_casefold()</function></link> followed by <link linkend="g-utf8-collate"><function>g_utf8_collate()</function></link> is
only an approximation to the correct linguistic case insensitive
ordering, though it is a fairly good one. Getting this exactly
right would require a more sophisticated collation function that
takes case sensitivity into account. GLib does not currently
provide such a function.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> length of <parameter>str</parameter>, in bytes, or -1 if <parameter>str</parameter> is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a newly allocated string, that is a
  case independent form of <parameter>str</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-normalize" role="function">
<title>g_utf8_normalize ()</title>
<indexterm zone="g-utf8-normalize"><primary sortas="utf8_normalize">g_utf8_normalize</primary></indexterm><programlisting><link linkend="gchar">gchar</link> *             g_utf8_normalize                    (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> len,
                                                         <link linkend="GNormalizeMode">GNormalizeMode</link> mode);</programlisting>
<para>
Converts a string into canonical form, standardizing
such issues as whether a character with an accent
is represented as a base character and combining
accent or as a single precomposed character. The
string has to be valid UTF-8, otherwise <link linkend="NULL--CAPS"><literal>NULL</literal></link> is
returned. You should generally call <link linkend="g-utf8-normalize"><function>g_utf8_normalize()</function></link>
before comparing two Unicode strings.
</para>
<para>
The normalization mode <link linkend="G-NORMALIZE-DEFAULT--CAPS"><literal>G_NORMALIZE_DEFAULT</literal></link> only
standardizes differences that do not affect the
text content, such as the above-mentioned accent
representation. <link linkend="G-NORMALIZE-ALL--CAPS"><literal>G_NORMALIZE_ALL</literal></link> also standardizes
the "compatibility" characters in Unicode, such
as SUPERSCRIPT THREE to the standard forms
(in this case DIGIT THREE). Formatting information
may be lost but for most text operations such
characters should be considered the same.
</para>
<para>
<link linkend="G-NORMALIZE-DEFAULT-COMPOSE--CAPS"><literal>G_NORMALIZE_DEFAULT_COMPOSE</literal></link> and <link linkend="G-NORMALIZE-ALL-COMPOSE--CAPS"><literal>G_NORMALIZE_ALL_COMPOSE</literal></link>
are like <link linkend="G-NORMALIZE-DEFAULT--CAPS"><literal>G_NORMALIZE_DEFAULT</literal></link> and <link linkend="G-NORMALIZE-ALL--CAPS"><literal>G_NORMALIZE_ALL</literal></link>,
but returned a result with composed forms rather
than a maximally decomposed form. This is often
useful if you intend to convert the string to
a legacy encoding or pass it to a system with
less capable Unicode handling.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UTF-8 encoded string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> length of <parameter>str</parameter>, in bytes, or -1 if <parameter>str</parameter> is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>mode</parameter>&#160;:</term>
<listitem><simpara> the type of normalization to perform.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a newly allocated string, that is the
  normalized form of <parameter>str</parameter>, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if <parameter>str</parameter> is not
  valid UTF-8.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="GNormalizeMode" role="enum">
<title>enum GNormalizeMode</title>
<indexterm zone="GNormalizeMode"><primary sortas="NormalizeMode">GNormalizeMode</primary></indexterm><programlisting>typedef enum {
  G_NORMALIZE_DEFAULT,
  G_NORMALIZE_NFD = G_NORMALIZE_DEFAULT,
  G_NORMALIZE_DEFAULT_COMPOSE,
  G_NORMALIZE_NFC = G_NORMALIZE_DEFAULT_COMPOSE,
  G_NORMALIZE_ALL,
  G_NORMALIZE_NFKD = G_NORMALIZE_ALL,
  G_NORMALIZE_ALL_COMPOSE,
  G_NORMALIZE_NFKC = G_NORMALIZE_ALL_COMPOSE
} GNormalizeMode;
</programlisting>
<para>
Defines how a Unicode string is transformed in a canonical
form, standardizing such issues as whether a character with an accent is
represented as a base character and combining accent or as a single precomposed
character. Unicode strings should generally be normalized before comparing them.
</para><variablelist role="enum">
<varlistentry id="G-NORMALIZE-DEFAULT--CAPS" role="constant">
<term><literal>G_NORMALIZE_DEFAULT</literal></term>
<listitem><simpara>standardize differences that do not affect the
  text content, such as the above-mentioned accent representation.
</simpara></listitem>
</varlistentry>
<varlistentry id="G-NORMALIZE-NFD--CAPS" role="constant">
<term><literal>G_NORMALIZE_NFD</literal></term>
<listitem><simpara>another name for <link linkend="G-NORMALIZE-DEFAULT--CAPS"><literal>G_NORMALIZE_DEFAULT</literal></link>.
</simpara></listitem>
</varlistentry>
<varlistentry id="G-NORMALIZE-DEFAULT-COMPOSE--CAPS" role="constant">
<term><literal>G_NORMALIZE_DEFAULT_COMPOSE</literal></term>
<listitem><simpara>like <link linkend="G-NORMALIZE-DEFAULT--CAPS"><literal>G_NORMALIZE_DEFAULT</literal></link>, but with composed
  forms rather than a maximally decomposed form.
</simpara></listitem>
</varlistentry>
<varlistentry id="G-NORMALIZE-NFC--CAPS" role="constant">
<term><literal>G_NORMALIZE_NFC</literal></term>
<listitem><simpara>another name for <link linkend="G-NORMALIZE-DEFAULT-COMPOSE--CAPS"><literal>G_NORMALIZE_DEFAULT_COMPOSE</literal></link>.
</simpara></listitem>
</varlistentry>
<varlistentry id="G-NORMALIZE-ALL--CAPS" role="constant">
<term><literal>G_NORMALIZE_ALL</literal></term>
<listitem><simpara>beyond <link linkend="G-NORMALIZE-DEFAULT--CAPS"><literal>G_NORMALIZE_DEFAULT</literal></link> also standardize the 
  "compatibility" characters in Unicode, such as SUPERSCRIPT THREE to the
  standard forms (in this case DIGIT THREE). Formatting information may be
  lost but for most text operations such characters should be considered the
  same.
</simpara></listitem>
</varlistentry>
<varlistentry id="G-NORMALIZE-NFKD--CAPS" role="constant">
<term><literal>G_NORMALIZE_NFKD</literal></term>
<listitem><simpara>another name for <link linkend="G-NORMALIZE-ALL--CAPS"><literal>G_NORMALIZE_ALL</literal></link>.
</simpara></listitem>
</varlistentry>
<varlistentry id="G-NORMALIZE-ALL-COMPOSE--CAPS" role="constant">
<term><literal>G_NORMALIZE_ALL_COMPOSE</literal></term>
<listitem><simpara>like <link linkend="G-NORMALIZE-ALL--CAPS"><literal>G_NORMALIZE_ALL</literal></link>, but with composed
  forms rather than a maximally decomposed form.
</simpara></listitem>
</varlistentry>
<varlistentry id="G-NORMALIZE-NFKC--CAPS" role="constant">
<term><literal>G_NORMALIZE_NFKC</literal></term>
<listitem><simpara>another name for <link linkend="G-NORMALIZE-ALL-COMPOSE--CAPS"><literal>G_NORMALIZE_ALL_COMPOSE</literal></link>.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-collate" role="function">
<title>g_utf8_collate ()</title>
<indexterm zone="g-utf8-collate"><primary sortas="utf8_collate">g_utf8_collate</primary></indexterm><programlisting><link linkend="gint">gint</link>                g_utf8_collate                      (const <link linkend="gchar">gchar</link> *str1,
                                                         const <link linkend="gchar">gchar</link> *str2);</programlisting>
<para>
Compares two strings for ordering using the linguistically
correct rules for the <link linkend="setlocale">current locale</link>. 
When sorting a large number of strings, it will be significantly 
faster to obtain collation keys with <link linkend="g-utf8-collate-key"><function>g_utf8_collate_key()</function></link> and 
compare the keys with <link linkend="strcmp"><function>strcmp()</function></link> when sorting instead of sorting 
the original strings.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str1</parameter>&#160;:</term>
<listitem><simpara> a UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>str2</parameter>&#160;:</term>
<listitem><simpara> a UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> &lt; 0 if <parameter>str1</parameter> compares before <parameter>str2</parameter>, 
  0 if they compare equal, &gt; 0 if <parameter>str1</parameter> compares after <parameter>str2</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-collate-key" role="function">
<title>g_utf8_collate_key ()</title>
<indexterm zone="g-utf8-collate-key"><primary sortas="utf8_collate_key">g_utf8_collate_key</primary></indexterm><programlisting><link linkend="gchar">gchar</link> *             g_utf8_collate_key                  (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> len);</programlisting>
<para>
Converts a string into a collation key that can be compared
with other collation keys produced by the same function using 
<link linkend="strcmp"><function>strcmp()</function></link>. 
</para>
<para>
The results of comparing the collation keys of two strings 
with <link linkend="strcmp"><function>strcmp()</function></link> will always be the same as comparing the two 
original keys with <link linkend="g-utf8-collate"><function>g_utf8_collate()</function></link>.
</para>
<para>
Note that this function depends on the 
<link linkend="setlocale">current locale</link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UTF-8 encoded string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> length of <parameter>str</parameter>, in bytes, or -1 if <parameter>str</parameter> is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a newly allocated string. This string should
  be freed with <link linkend="g-free"><function>g_free()</function></link> when you are done with it.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-collate-key-for-filename" role="function" condition="since:2.8">
<title>g_utf8_collate_key_for_filename ()</title>
<indexterm zone="g-utf8-collate-key-for-filename" role="2.8"><primary sortas="utf8_collate_key_for_filename">g_utf8_collate_key_for_filename</primary></indexterm><programlisting><link linkend="gchar">gchar</link> *             g_utf8_collate_key_for_filename     (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="gssize">gssize</link> len);</programlisting>
<para>
Converts a string into a collation key that can be compared
with other collation keys produced by the same function using <link linkend="strcmp"><function>strcmp()</function></link>. 
</para>
<para>
In order to sort filenames correctly, this function treats the dot '.' 
as a special case. Most dictionary orderings seem to consider it
insignificant, thus producing the ordering "event.c" "eventgenerator.c"
"event.h" instead of "event.c" "event.h" "eventgenerator.c". Also, we
would like to treat numbers intelligently so that "file1" "file10" "file5"
is sorted as "file1" "file5" "file10".
</para>
<para>
Note that this function depends on the 
<link linkend="setlocale">current locale</link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UTF-8 encoded string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> length of <parameter>str</parameter>, in bytes, or -1 if <parameter>str</parameter> is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a newly allocated string. This string should
  be freed with <link linkend="g-free"><function>g_free()</function></link> when you are done with it.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.8</para></refsect2>
<refsect2 id="g-utf8-to-utf16" role="function">
<title>g_utf8_to_utf16 ()</title>
<indexterm zone="g-utf8-to-utf16"><primary sortas="utf8_to_utf16">g_utf8_to_utf16</primary></indexterm><programlisting><link linkend="gunichar2">gunichar2</link> *         g_utf8_to_utf16                     (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="glong">glong</link> len,
                                                         <link linkend="glong">glong</link> *items_read,
                                                         <link linkend="glong">glong</link> *items_written,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Convert a string from UTF-8 to UTF-16. A 0 character will be
added to the result after the converted text.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> the maximum length (number of bytes) of <parameter>str</parameter> to use.
      If <parameter>len</parameter> &lt; 0, then the string is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_read</parameter>&#160;:</term>
<listitem><simpara> location to store number of bytes read, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
             If <link linkend="NULL--CAPS"><literal>NULL</literal></link>, then <link linkend="G-CONVERT-ERROR-PARTIAL-INPUT--CAPS"><literal>G_CONVERT_ERROR_PARTIAL_INPUT</literal></link> will be
             returned in case <parameter>str</parameter> contains a trailing partial
             character. If an error occurs then the index of the
             invalid input is stored here.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_written</parameter>&#160;:</term>
<listitem><simpara> location to store number of <type>gunichar2</type> written,
                or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
                The value stored here does not include the trailing 0.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara> location to store the error occuring, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> to ignore
        errors. Any of the errors in <link linkend="GConvertError"><type>GConvertError</type></link> other than
        <link linkend="G-CONVERT-ERROR-NO-CONVERSION--CAPS"><literal>G_CONVERT_ERROR_NO_CONVERSION</literal></link> may occur.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a pointer to a newly allocated UTF-16 string.
              This value must be freed with <link linkend="g-free"><function>g_free()</function></link>. If an
              error occurs, <link linkend="NULL--CAPS"><literal>NULL</literal></link> will be returned and
              <parameter>error</parameter> set.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-to-ucs4" role="function">
<title>g_utf8_to_ucs4 ()</title>
<indexterm zone="g-utf8-to-ucs4"><primary sortas="utf8_to_ucs4">g_utf8_to_ucs4</primary></indexterm><programlisting><link linkend="gunichar">gunichar</link> *          g_utf8_to_ucs4                      (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="glong">glong</link> len,
                                                         <link linkend="glong">glong</link> *items_read,
                                                         <link linkend="glong">glong</link> *items_written,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Convert a string from UTF-8 to a 32-bit fixed width
representation as UCS-4. A trailing 0 will be added to the
string after the converted text.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> the maximum length of <parameter>str</parameter> to use, in bytes. If <parameter>len</parameter> &lt; 0,
      then the string is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_read</parameter>&#160;:</term>
<listitem><simpara> location to store number of bytes read, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
             If <link linkend="NULL--CAPS"><literal>NULL</literal></link>, then <link linkend="G-CONVERT-ERROR-PARTIAL-INPUT--CAPS"><literal>G_CONVERT_ERROR_PARTIAL_INPUT</literal></link> will be
             returned in case <parameter>str</parameter> contains a trailing partial
             character. If an error occurs then the index of the
             invalid input is stored here.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_written</parameter>&#160;:</term>
<listitem><simpara> location to store number of characters written or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
                The value here stored does not include the trailing 0
                character. 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara> location to store the error occuring, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> to ignore
        errors. Any of the errors in <link linkend="GConvertError"><type>GConvertError</type></link> other than
        <link linkend="G-CONVERT-ERROR-NO-CONVERSION--CAPS"><literal>G_CONVERT_ERROR_NO_CONVERSION</literal></link> may occur.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a pointer to a newly allocated UCS-4 string.
              This value must be freed with <link linkend="g-free"><function>g_free()</function></link>. If an
              error occurs, <link linkend="NULL--CAPS"><literal>NULL</literal></link> will be returned and
              <parameter>error</parameter> set.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf8-to-ucs4-fast" role="function">
<title>g_utf8_to_ucs4_fast ()</title>
<indexterm zone="g-utf8-to-ucs4-fast"><primary sortas="utf8_to_ucs4_fast">g_utf8_to_ucs4_fast</primary></indexterm><programlisting><link linkend="gunichar">gunichar</link> *          g_utf8_to_ucs4_fast                 (const <link linkend="gchar">gchar</link> *str,
                                                         <link linkend="glong">glong</link> len,
                                                         <link linkend="glong">glong</link> *items_written);</programlisting>
<para>
Convert a string from UTF-8 to a 32-bit fixed width
representation as UCS-4, assuming valid UTF-8 input.
This function is roughly twice as fast as <link linkend="g-utf8-to-ucs4"><function>g_utf8_to_ucs4()</function></link>
but does no error checking on the input.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> the maximum length of <parameter>str</parameter> to use, in bytes. If <parameter>len</parameter> &lt; 0,
      then the string is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_written</parameter>&#160;:</term>
<listitem><simpara> location to store the number of characters in the
                result, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a pointer to a newly allocated UCS-4 string.
              This value must be freed with <link linkend="g-free"><function>g_free()</function></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf16-to-ucs4" role="function">
<title>g_utf16_to_ucs4 ()</title>
<indexterm zone="g-utf16-to-ucs4"><primary sortas="utf16_to_ucs4">g_utf16_to_ucs4</primary></indexterm><programlisting><link linkend="gunichar">gunichar</link> *          g_utf16_to_ucs4                     (const <link linkend="gunichar2">gunichar2</link> *str,
                                                         <link linkend="glong">glong</link> len,
                                                         <link linkend="glong">glong</link> *items_read,
                                                         <link linkend="glong">glong</link> *items_written,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Convert a string from UTF-16 to UCS-4. The result will be
nul-terminated.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UTF-16 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> the maximum length (number of <type>gunichar2</type>) of <parameter>str</parameter> to use. 
      If <parameter>len</parameter> &lt; 0, then the string is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_read</parameter>&#160;:</term>
<listitem><simpara> location to store number of words read, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
             If <link linkend="NULL--CAPS"><literal>NULL</literal></link>, then <link linkend="G-CONVERT-ERROR-PARTIAL-INPUT--CAPS"><literal>G_CONVERT_ERROR_PARTIAL_INPUT</literal></link> will be
             returned in case <parameter>str</parameter> contains a trailing partial
             character. If an error occurs then the index of the
             invalid input is stored here.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_written</parameter>&#160;:</term>
<listitem><simpara> location to store number of characters written, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
                The value stored here does not include the trailing
                0 character.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara> location to store the error occuring, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> to ignore
        errors. Any of the errors in <link linkend="GConvertError"><type>GConvertError</type></link> other than
        <link linkend="G-CONVERT-ERROR-NO-CONVERSION--CAPS"><literal>G_CONVERT_ERROR_NO_CONVERSION</literal></link> may occur.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a pointer to a newly allocated UCS-4 string.
              This value must be freed with <link linkend="g-free"><function>g_free()</function></link>. If an
              error occurs, <link linkend="NULL--CAPS"><literal>NULL</literal></link> will be returned and
              <parameter>error</parameter> set.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-utf16-to-utf8" role="function">
<title>g_utf16_to_utf8 ()</title>
<indexterm zone="g-utf16-to-utf8"><primary sortas="utf16_to_utf8">g_utf16_to_utf8</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*              g_utf16_to_utf8                     (const <link linkend="gunichar2">gunichar2</link> *str,
                                                         <link linkend="glong">glong</link> len,
                                                         <link linkend="glong">glong</link> *items_read,
                                                         <link linkend="glong">glong</link> *items_written,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Convert a string from UTF-16 to UTF-8. The result will be
terminated with a 0 byte.
</para>
<para>
Note that the input is expected to be already in native endianness,
an initial byte-order-mark character is not handled specially.
<link linkend="g-convert"><function>g_convert()</function></link> can be used to convert a byte buffer of UTF-16 data of 
ambiguous endianess.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UTF-16 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> the maximum length (number of <type>gunichar2</type>) of <parameter>str</parameter> to use. 
      If <parameter>len</parameter> &lt; 0, then the string is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_read</parameter>&#160;:</term>
<listitem><simpara> location to store number of words read, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
             If <link linkend="NULL--CAPS"><literal>NULL</literal></link>, then <link linkend="G-CONVERT-ERROR-PARTIAL-INPUT--CAPS"><literal>G_CONVERT_ERROR_PARTIAL_INPUT</literal></link> will be
             returned in case <parameter>str</parameter> contains a trailing partial
             character. If an error occurs then the index of the
             invalid input is stored here.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_written</parameter>&#160;:</term>
<listitem><simpara> location to store number of bytes written, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
                The value stored here does not include the trailing
                0 byte.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara> location to store the error occuring, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> to ignore
        errors. Any of the errors in <link linkend="GConvertError"><type>GConvertError</type></link> other than
        <link linkend="G-CONVERT-ERROR-NO-CONVERSION--CAPS"><literal>G_CONVERT_ERROR_NO_CONVERSION</literal></link> may occur.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a pointer to a newly allocated UTF-8 string.
              This value must be freed with <link linkend="g-free"><function>g_free()</function></link>. If an
              error occurs, <link linkend="NULL--CAPS"><literal>NULL</literal></link> will be returned and
              <parameter>error</parameter> set.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-ucs4-to-utf16" role="function">
<title>g_ucs4_to_utf16 ()</title>
<indexterm zone="g-ucs4-to-utf16"><primary sortas="ucs4_to_utf16">g_ucs4_to_utf16</primary></indexterm><programlisting><link linkend="gunichar2">gunichar2</link> *         g_ucs4_to_utf16                     (const <link linkend="gunichar">gunichar</link> *str,
                                                         <link linkend="glong">glong</link> len,
                                                         <link linkend="glong">glong</link> *items_read,
                                                         <link linkend="glong">glong</link> *items_written,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Convert a string from UCS-4 to UTF-16. A 0 character will be
added to the result after the converted text.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UCS-4 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> the maximum length (number of characters) of <parameter>str</parameter> to use. 
      If <parameter>len</parameter> &lt; 0, then the string is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_read</parameter>&#160;:</term>
<listitem><simpara> location to store number of bytes read, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
             If an error occurs then the index of the invalid input
             is stored here.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_written</parameter>&#160;:</term>
<listitem><simpara> location to store number of <type>gunichar2</type> 
                written, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>. The value stored here does not 
                include the trailing 0.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara> location to store the error occuring, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> to ignore
        errors. Any of the errors in <link linkend="GConvertError"><type>GConvertError</type></link> other than
        <link linkend="G-CONVERT-ERROR-NO-CONVERSION--CAPS"><literal>G_CONVERT_ERROR_NO_CONVERSION</literal></link> may occur.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a pointer to a newly allocated UTF-16 string.
              This value must be freed with <link linkend="g-free"><function>g_free()</function></link>. If an
              error occurs, <link linkend="NULL--CAPS"><literal>NULL</literal></link> will be returned and
              <parameter>error</parameter> set.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-ucs4-to-utf8" role="function">
<title>g_ucs4_to_utf8 ()</title>
<indexterm zone="g-ucs4-to-utf8"><primary sortas="ucs4_to_utf8">g_ucs4_to_utf8</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*              g_ucs4_to_utf8                      (const <link linkend="gunichar">gunichar</link> *str,
                                                         <link linkend="glong">glong</link> len,
                                                         <link linkend="glong">glong</link> *items_read,
                                                         <link linkend="glong">glong</link> *items_written,
                                                         <link linkend="GError">GError</link> **error);</programlisting>
<para>
Convert a string from a 32-bit fixed width representation as UCS-4.
to UTF-8. The result will be terminated with a 0 byte.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&#160;:</term>
<listitem><simpara> a UCS-4 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> the maximum length (number of characters) of <parameter>str</parameter> to use. 
      If <parameter>len</parameter> &lt; 0, then the string is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_read</parameter>&#160;:</term>
<listitem><simpara> location to store number of characters read, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_written</parameter>&#160;:</term>
<listitem><simpara> location to store number of bytes written or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
                The value here stored does not include the trailing 0
                byte. 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara> location to store the error occuring, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> to ignore
        errors. Any of the errors in <link linkend="GConvertError"><type>GConvertError</type></link> other than
        <link linkend="G-CONVERT-ERROR-NO-CONVERSION--CAPS"><literal>G_CONVERT_ERROR_NO_CONVERSION</literal></link> may occur.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a pointer to a newly allocated UTF-8 string.
              This value must be freed with <link linkend="g-free"><function>g_free()</function></link>. If an
              error occurs, <link linkend="NULL--CAPS"><literal>NULL</literal></link> will be returned and
              <parameter>error</parameter> set. In that case, <parameter>items_read</parameter> will be
              set to the position of the first invalid input 
              character.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-unichar-to-utf8" role="function">
<title>g_unichar_to_utf8 ()</title>
<indexterm zone="g-unichar-to-utf8"><primary sortas="unichar_to_utf8">g_unichar_to_utf8</primary></indexterm><programlisting><link linkend="gint">gint</link>                g_unichar_to_utf8                   (<link linkend="gunichar">gunichar</link> c,
                                                         <link linkend="gchar">gchar</link> *outbuf);</programlisting>
<para>
Converts a single character to UTF-8.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter>&#160;:</term>
<listitem><simpara> a Unicode character code
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>outbuf</parameter>&#160;:</term>
<listitem><simpara> output buffer, must have at least 6 bytes of space.
      If <link linkend="NULL--CAPS"><literal>NULL</literal></link>, the length will be computed and returned
      and nothing will be written to <parameter>outbuf</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> number of bytes written
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>



<refsect1 id="glib-Unicode-Manipulation.see-also">
<title>See Also</title>
<para>
<variablelist>
<varlistentry>
<term><link linkend="g-locale-to-utf8"><function>g_locale_to_utf8()</function></link>, <link linkend="g-locale-from-utf8"><function>g_locale_from_utf8()</function></link></term>
<listitem><para>
Convenience functions for converting between UTF-8 and the locale encoding.
</para></listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>

</refentry>
