libidn-stringprep.html   [plain text]


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>stringprep</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.71.0">
<link rel="start" href="index.html" title="GNU Libidn API Reference Manual">
<link rel="up" href="ch01.html" title="GNU Libidn API Reference Manual">
<link rel="prev" href="libidn-tld.html" title="tld">
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="ch01.html" title="GNU Libidn API Reference Manual">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="libidn-tld.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GNU Libidn API Reference Manual</th>
<td>&#160;</td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2557062" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id2553217" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="libidn-stringprep"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2557062"></a><span class="refentrytitle">stringprep</span>
</h2>
<p>stringprep</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">



#define     <a href="libidn-stringprep.html#STRINGPREP-VERSION:CAPS">STRINGPREP_VERSION</a>
enum        <a href="libidn-stringprep.html#Stringprep-rc">Stringprep_rc</a>;
enum        <a href="libidn-stringprep.html#Stringprep-profile-flags">Stringprep_profile_flags</a>;
enum        <a href="libidn-stringprep.html#Stringprep-profile-steps">Stringprep_profile_steps</a>;
#define     <a href="libidn-stringprep.html#STRINGPREP-MAX-MAP-CHARS:CAPS">STRINGPREP_MAX_MAP_CHARS</a>
struct      <a href="libidn-stringprep.html#Stringprep-table-element">Stringprep_table_element</a>;
struct      <a href="libidn-stringprep.html#Stringprep-table">Stringprep_table</a>;
typedef     <a href="libidn-stringprep.html#Stringprep-profile">Stringprep_profile</a>;
struct      <a href="libidn-stringprep.html#Stringprep-profiles">Stringprep_profiles</a>;
#define     <a href="libidn-stringprep.html#stringprep-nameprep">stringprep_nameprep</a>             (in, maxlen)
#define     <a href="libidn-stringprep.html#stringprep-nameprep-no-unassigned">stringprep_nameprep_no_unassigned</a>(in, maxlen)
#define     <a href="libidn-stringprep.html#stringprep-plain">stringprep_plain</a>                (in, maxlen)
#define     <a href="libidn-stringprep.html#stringprep-kerberos5">stringprep_kerberos5</a>            (in, maxlen)
#define     <a href="libidn-stringprep.html#stringprep-xmpp-nodeprep">stringprep_xmpp_nodeprep</a>        (in, maxlen)
#define     <a href="libidn-stringprep.html#stringprep-xmpp-resourceprep">stringprep_xmpp_resourceprep</a>    (in, maxlen)
#define     <a href="libidn-stringprep.html#stringprep-iscsi">stringprep_iscsi</a>                (in, maxlen)
int         <a href="libidn-stringprep.html#stringprep-4i">stringprep_4i</a>                   (uint32_t *ucs4,
                                             size_t *len,
                                             size_t maxucs4len,
                                             <a href="libidn-stringprep.html#Stringprep-profile-flags">Stringprep_profile_flags</a> flags,
                                             const <a href="libidn-stringprep.html#Stringprep-profile">Stringprep_profile</a> *profile);
int         <a href="libidn-stringprep.html#stringprep-4zi">stringprep_4zi</a>                  (uint32_t *ucs4,
                                             size_t maxucs4len,
                                             <a href="libidn-stringprep.html#Stringprep-profile-flags">Stringprep_profile_flags</a> flags,
                                             const <a href="libidn-stringprep.html#Stringprep-profile">Stringprep_profile</a> *profile);
int         <a href="libidn-stringprep.html#stringprep">stringprep</a>                      (char *in,
                                             size_t maxlen,
                                             <a href="libidn-stringprep.html#Stringprep-profile-flags">Stringprep_profile_flags</a> flags,
                                             const <a href="libidn-stringprep.html#Stringprep-profile">Stringprep_profile</a> *profile);
int         <a href="libidn-stringprep.html#stringprep-profile">stringprep_profile</a>              (const char *in,
                                             char **out,
                                             const char *profile,
                                             <a href="libidn-stringprep.html#Stringprep-profile-flags">Stringprep_profile_flags</a> flags);
const char* <a href="libidn-stringprep.html#stringprep-strerror">stringprep_strerror</a>             (<a href="libidn-stringprep.html#Stringprep-rc">Stringprep_rc</a> rc);
const char* <a href="libidn-stringprep.html#stringprep-check-version">stringprep_check_version</a>        (const char *req_version);
int         <a href="libidn-stringprep.html#stringprep-unichar-to-utf8">stringprep_unichar_to_utf8</a>      (uint32_t c,
                                             char *outbuf);
uint32_t    <a href="libidn-stringprep.html#stringprep-utf8-to-unichar">stringprep_utf8_to_unichar</a>      (const char *p);
uint32_t*   <a href="libidn-stringprep.html#stringprep-utf8-to-ucs4">stringprep_utf8_to_ucs4</a>         (const char *str,
                                             ssize_t len,
                                             size_t *items_written);
char*       <a href="libidn-stringprep.html#stringprep-ucs4-to-utf8">stringprep_ucs4_to_utf8</a>         (const uint32_t *str,
                                             ssize_t len,
                                             size_t *items_read,
                                             size_t *items_written);
char*       <a href="libidn-stringprep.html#stringprep-utf8-nfkc-normalize">stringprep_utf8_nfkc_normalize</a>  (const char *str,
                                             ssize_t len);
uint32_t*   <a href="libidn-stringprep.html#stringprep-ucs4-nfkc-normalize">stringprep_ucs4_nfkc_normalize</a>  (uint32_t *str,
                                             ssize_t len);
const char* <a href="libidn-stringprep.html#stringprep-locale-charset">stringprep_locale_charset</a>       (void);
char*       <a href="libidn-stringprep.html#stringprep-convert">stringprep_convert</a>              (const char *str,
                                             const char *to_codeset,
                                             const char *from_codeset);
char*       <a href="libidn-stringprep.html#stringprep-locale-to-utf8">stringprep_locale_to_utf8</a>       (const char *str);
char*       <a href="libidn-stringprep.html#stringprep-utf8-to-locale">stringprep_utf8_to_locale</a>       (const char *str);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2553217"></a><h2>Description</h2>
<p>

</p>
</div>
<div class="refsect1" lang="en">
<a name="id2553233"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2553244"></a><h3>
<a name="STRINGPREP-VERSION:CAPS"></a>STRINGPREP_VERSION</h3>
<a class="indexterm" name="id2553255"></a><pre class="programlisting">#define STRINGPREP_VERSION "0.6.14"
</pre>
<p>
String defined via CPP denoting the header file version number.
Used together with <a href="libidn-stringprep.html#stringprep-check-version"><code class="function">stringprep_check_version()</code></a> to verify header file
and run-time library consistency.</p>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586606"></a><h3>
<a name="Stringprep-rc"></a>enum Stringprep_rc</h3>
<a class="indexterm" name="id2586618"></a><pre class="programlisting">  typedef enum
  {
    STRINGPREP_OK = 0,
    /* Stringprep errors. */
    STRINGPREP_CONTAINS_UNASSIGNED = 1,
    STRINGPREP_CONTAINS_PROHIBITED = 2,
    STRINGPREP_BIDI_BOTH_L_AND_RAL = 3,
    STRINGPREP_BIDI_LEADTRAIL_NOT_RAL = 4,
    STRINGPREP_BIDI_CONTAINS_PROHIBITED = 5,
    /* Error in calling application. */
    STRINGPREP_TOO_SMALL_BUFFER = 100,
    STRINGPREP_PROFILE_ERROR = 101,
    STRINGPREP_FLAG_ERROR = 102,
    STRINGPREP_UNKNOWN_PROFILE = 103,
    /* Internal errors. */
    STRINGPREP_NFKC_FAILED = 200,
    STRINGPREP_MALLOC_ERROR = 201
  } Stringprep_rc;
</pre>
<p>
Enumerated return codes of <a href="libidn-stringprep.html#stringprep"><code class="function">stringprep()</code></a>, <a href="libidn-stringprep.html#stringprep-profile"><code class="function">stringprep_profile()</code></a>
functions (and macros using those functions).  The value 0 is
guaranteed to always correspond to success.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><a name="STRINGPREP-OK:CAPS"></a><code class="literal">STRINGPREP_OK</code></span></td>
<td> Successful operation.  This value is guaranteed to
  always be zero, the remaining ones are only guaranteed to hold
  non-zero values, for logical comparison purposes.
</td>
</tr>
<tr>
<td><span class="term"><a name="STRINGPREP-CONTAINS-UNASSIGNED:CAPS"></a><code class="literal">STRINGPREP_CONTAINS_UNASSIGNED</code></span></td>
<td> String contain unassigned Unicode
  code points, which is forbidden by the profile.
</td>
</tr>
<tr>
<td><span class="term"><a name="STRINGPREP-CONTAINS-PROHIBITED:CAPS"></a><code class="literal">STRINGPREP_CONTAINS_PROHIBITED</code></span></td>
<td> String contain code points
  prohibited by the profile.
</td>
</tr>
<tr>
<td><span class="term"><a name="STRINGPREP-BIDI-BOTH-L-AND-RAL:CAPS"></a><code class="literal">STRINGPREP_BIDI_BOTH_L_AND_RAL</code></span></td>
<td> String contain code points with
  conflicting bidirection category.
</td>
</tr>
<tr>
<td><span class="term"><a name="STRINGPREP-BIDI-LEADTRAIL-NOT-RAL:CAPS"></a><code class="literal">STRINGPREP_BIDI_LEADTRAIL_NOT_RAL</code></span></td>
<td> Leading and trailing character
  in string not of proper bidirectional category.
</td>
</tr>
<tr>
<td><span class="term"><a name="STRINGPREP-BIDI-CONTAINS-PROHIBITED:CAPS"></a><code class="literal">STRINGPREP_BIDI_CONTAINS_PROHIBITED</code></span></td>
<td> Contains prohibited code
  points detected by bidirectional code.
</td>
</tr>
<tr>
<td><span class="term"><a name="STRINGPREP-TOO-SMALL-BUFFER:CAPS"></a><code class="literal">STRINGPREP_TOO_SMALL_BUFFER</code></span></td>
<td> Buffer handed to function was too
  small.  This usually indicate a problem in the calling
  application.
</td>
</tr>
<tr>
<td><span class="term"><a name="STRINGPREP-PROFILE-ERROR:CAPS"></a><code class="literal">STRINGPREP_PROFILE_ERROR</code></span></td>
<td> The stringprep profile was inconsistent.
  This usually indicate an internal error in the library.
</td>
</tr>
<tr>
<td><span class="term"><a name="STRINGPREP-FLAG-ERROR:CAPS"></a><code class="literal">STRINGPREP_FLAG_ERROR</code></span></td>
<td> The supplied flag conflicted with profile.
  This usually indicate a problem in the calling application.
</td>
</tr>
<tr>
<td><span class="term"><a name="STRINGPREP-UNKNOWN-PROFILE:CAPS"></a><code class="literal">STRINGPREP_UNKNOWN_PROFILE</code></span></td>
<td> The supplied profile name was not
  known to the library.
</td>
</tr>
<tr>
<td><span class="term"><a name="STRINGPREP-NFKC-FAILED:CAPS"></a><code class="literal">STRINGPREP_NFKC_FAILED</code></span></td>
<td> The Unicode NFKC operation failed.  This
  usually indicate an internal error in the library.
</td>
</tr>
<tr>
<td><span class="term"><a name="STRINGPREP-MALLOC-ERROR:CAPS"></a><code class="literal">STRINGPREP_MALLOC_ERROR</code></span></td>
<td> The <code class="function">malloc()</code> was out of memory.  This is
  usually a fatal error.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600027"></a><h3>
<a name="Stringprep-profile-flags"></a>enum Stringprep_profile_flags</h3>
<a class="indexterm" name="id2600037"></a><pre class="programlisting">  typedef enum
  {
    STRINGPREP_NO_NFKC = 1,
    STRINGPREP_NO_BIDI = 2,
    STRINGPREP_NO_UNASSIGNED = 4
  } Stringprep_profile_flags;
</pre>
<p>
Stringprep profile flags.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><a name="STRINGPREP-NO-NFKC:CAPS"></a><code class="literal">STRINGPREP_NO_NFKC</code></span></td>
<td> Disable the NFKC normalization, as well as
  selecting the non-NFKC case folding tables.  Usually the profile
  specifies BIDI and NFKC settings, and applications should not
  override it unless in special situations.
</td>
</tr>
<tr>
<td><span class="term"><a name="STRINGPREP-NO-BIDI:CAPS"></a><code class="literal">STRINGPREP_NO_BIDI</code></span></td>
<td> Disable the BIDI step.  Usually the profile
  specifies BIDI and NFKC settings, and applications should not
  override it unless in special situations.
</td>
</tr>
<tr>
<td><span class="term"><a name="STRINGPREP-NO-UNASSIGNED:CAPS"></a><code class="literal">STRINGPREP_NO_UNASSIGNED</code></span></td>
<td> Make the library return with an error if
  string contains unassigned characters according to profile.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600127"></a><h3>
<a name="Stringprep-profile-steps"></a>enum Stringprep_profile_steps</h3>
<a class="indexterm" name="id2600137"></a><pre class="programlisting">  typedef enum
  {
    STRINGPREP_NFKC = 1,
    STRINGPREP_BIDI = 2,
    STRINGPREP_MAP_TABLE = 3,
    STRINGPREP_UNASSIGNED_TABLE = 4,
    STRINGPREP_PROHIBIT_TABLE = 5,
    STRINGPREP_BIDI_PROHIBIT_TABLE = 6,
    STRINGPREP_BIDI_RAL_TABLE = 7,
    STRINGPREP_BIDI_L_TABLE = 8
  } Stringprep_profile_steps;
</pre>
<p>
Various steps in the stringprep algorithm.  You really want to
study the source code to understand this one.  Only useful if you
want to add another profile.</p>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600162"></a><h3>
<a name="STRINGPREP-MAX-MAP-CHARS:CAPS"></a>STRINGPREP_MAX_MAP_CHARS</h3>
<a class="indexterm" name="id2600175"></a><pre class="programlisting">#define STRINGPREP_MAX_MAP_CHARS 4
</pre>
<p>
Maximum number of code points that can replace a single code point,
during stringprep mapping.</p>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600193"></a><h3>
<a name="Stringprep-table-element"></a>struct Stringprep_table_element</h3>
<a class="indexterm" name="id2600204"></a><pre class="programlisting">struct Stringprep_table_element {
    uint32_t start;
    uint32_t end;		/* 0 if only one character */
    uint32_t map[STRINGPREP_MAX_MAP_CHARS];	/* NULL if end is not 0 */
};
</pre>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600221"></a><h3>
<a name="Stringprep-table"></a>struct Stringprep_table</h3>
<a class="indexterm" name="id2600231"></a><pre class="programlisting">struct Stringprep_table {
    Stringprep_profile_steps operation;
    Stringprep_profile_flags flags;
    const Stringprep_table_element *table;
};
</pre>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600248"></a><h3>
<a name="Stringprep-profile"></a>Stringprep_profile</h3>
<a class="indexterm" name="id2600258"></a><pre class="programlisting">  typedef struct Stringprep_table Stringprep_profile;
</pre>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600273"></a><h3>
<a name="Stringprep-profiles"></a>struct Stringprep_profiles</h3>
<a class="indexterm" name="id2600283"></a><pre class="programlisting">struct Stringprep_profiles {
    const char *name;
    const Stringprep_profile *tables;
};
</pre>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600298"></a><h3>
<a name="stringprep-nameprep"></a>stringprep_nameprep()</h3>
<a class="indexterm" name="id2600309"></a><pre class="programlisting">#define     stringprep_nameprep(in, maxlen)</pre>
<p>
Prepare the input UTF-8 string according to the nameprep profile.
The AllowUnassigned flag is true, use
<a href="libidn-stringprep.html#stringprep-nameprep-no-unassigned"><code class="function">stringprep_nameprep_no_unassigned()</code></a> if you want a false
AllowUnassigned.  Returns 0 iff successful, or an error code.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>in</code></em>&#160;:</span></td>
<td> input/ouput array with string to prepare.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>maxlen</code></em>&#160;:</span></td>
<td> maximum length of input/output array.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600370"></a><h3>
<a name="stringprep-nameprep-no-unassigned"></a>stringprep_nameprep_no_unassigned()</h3>
<a class="indexterm" name="id2600382"></a><pre class="programlisting">#define     stringprep_nameprep_no_unassigned(in, maxlen)</pre>
<p>
Prepare the input UTF-8 string according to the nameprep profile.
The AllowUnassigned flag is false, use <a href="libidn-stringprep.html#stringprep-nameprep"><code class="function">stringprep_nameprep()</code></a> for
true AllowUnassigned.  Returns 0 iff successful, or an error code.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>in</code></em>&#160;:</span></td>
<td> input/ouput array with string to prepare.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>maxlen</code></em>&#160;:</span></td>
<td> maximum length of input/output array.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600443"></a><h3>
<a name="stringprep-plain"></a>stringprep_plain()</h3>
<a class="indexterm" name="id2600454"></a><pre class="programlisting">#define     stringprep_plain(in, maxlen)</pre>
<p>
Prepare the input UTF-8 string according to the draft SASL
ANONYMOUS profile.  Returns 0 iff successful, or an error code.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>in</code></em>&#160;:</span></td>
<td> input/ouput array with string to prepare.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>maxlen</code></em>&#160;:</span></td>
<td> maximum length of input/output array.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600504"></a><h3>
<a name="stringprep-kerberos5"></a>stringprep_kerberos5()</h3>
<a class="indexterm" name="id2600515"></a><pre class="programlisting">#define     stringprep_kerberos5(in, maxlen)</pre>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>in</code></em>&#160;:</span></td>
<td>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>maxlen</code></em>&#160;:</span></td>
<td>


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600559"></a><h3>
<a name="stringprep-xmpp-nodeprep"></a>stringprep_xmpp_nodeprep()</h3>
<a class="indexterm" name="id2600569"></a><pre class="programlisting">#define     stringprep_xmpp_nodeprep(in, maxlen)</pre>
<p>
Prepare the input UTF-8 string according to the draft XMPP node
identifier profile.  Returns 0 iff successful, or an error code.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>in</code></em>&#160;:</span></td>
<td> input/ouput array with string to prepare.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>maxlen</code></em>&#160;:</span></td>
<td> maximum length of input/output array.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600620"></a><h3>
<a name="stringprep-xmpp-resourceprep"></a>stringprep_xmpp_resourceprep()</h3>
<a class="indexterm" name="id2600633"></a><pre class="programlisting">#define     stringprep_xmpp_resourceprep(in, maxlen)</pre>
<p>
Prepare the input UTF-8 string according to the draft XMPP resource
identifier profile.  Returns 0 iff successful, or an error code.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>in</code></em>&#160;:</span></td>
<td> input/ouput array with string to prepare.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>maxlen</code></em>&#160;:</span></td>
<td> maximum length of input/output array.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600685"></a><h3>
<a name="stringprep-iscsi"></a>stringprep_iscsi()</h3>
<a class="indexterm" name="id2600695"></a><pre class="programlisting">#define     stringprep_iscsi(in, maxlen)</pre>
<p>
Prepare the input UTF-8 string according to the draft iSCSI
stringprep profile.  Returns 0 iff successful, or an error code.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>in</code></em>&#160;:</span></td>
<td> input/ouput array with string to prepare.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>maxlen</code></em>&#160;:</span></td>
<td> maximum length of input/output array.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600746"></a><h3>
<a name="stringprep-4i"></a>stringprep_4i ()</h3>
<a class="indexterm" name="id2600756"></a><pre class="programlisting">int         stringprep_4i                   (uint32_t *ucs4,
                                             size_t *len,
                                             size_t maxucs4len,
                                             <a href="libidn-stringprep.html#Stringprep-profile-flags">Stringprep_profile_flags</a> flags,
                                             const <a href="libidn-stringprep.html#Stringprep-profile">Stringprep_profile</a> *profile);</pre>
<p>
Prepare the input UCS-4 string according to the stringprep profile,
and write back the result to the input string.
</p>
<p>
The input is not required to be zero terminated (<em class="parameter"><code>ucs4</code></em>[<em class="parameter"><code>len</code></em>] = 0).
The output will not be zero terminated unless <em class="parameter"><code>ucs4</code></em>[<em class="parameter"><code>len</code></em>] = 0.
Instead, see <a href="libidn-stringprep.html#stringprep-4zi"><code class="function">stringprep_4zi()</code></a> if your input is zero terminated or
if you want the output to be.
</p>
<p>
Since the stringprep operation can expand the string, <em class="parameter"><code>maxucs4len</code></em>
indicate how large the buffer holding the string is.  This function
will not read or write to code points outside that size.
</p>
<p>
The <em class="parameter"><code>flags</code></em> are one of <a href="libidn-stringprep.html#Stringprep-profile-flags"><span class="type">Stringprep_profile_flags</span></a> values, or 0.
</p>
<p>
The <em class="parameter"><code>profile</code></em> contain the <a href="libidn-stringprep.html#Stringprep-profile"><span class="type">Stringprep_profile</span></a> instructions to
perform.  Your application can define new profiles, possibly
re-using the generic stringprep tables that always will be part of
the library, or use one of the currently supported profiles.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>ucs4</code></em>&#160;:</span></td>
<td> input/output array with string to prepare.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>len</code></em>&#160;:</span></td>
<td> on input, length of input array with Unicode code points,
  on exit, length of output array with Unicode code points.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>maxucs4len</code></em>&#160;:</span></td>
<td> maximum length of input/output array.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></td>
<td> a <a href="libidn-stringprep.html#Stringprep-profile-flags"><span class="type">Stringprep_profile_flags</span></a> value, or 0.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>profile</code></em>&#160;:</span></td>
<td> pointer to <a href="libidn-stringprep.html#Stringprep-profile"><span class="type">Stringprep_profile</span></a> to use.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> Returns <a href="libidn-stringprep.html#STRINGPREP-OK:CAPS"><code class="literal">STRINGPREP_OK</code></a> iff successful, or an
  <a href="libidn-stringprep.html#Stringprep-rc"><span class="type">Stringprep_rc</span></a> error code.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2600999"></a><h3>
<a name="stringprep-4zi"></a>stringprep_4zi ()</h3>
<a class="indexterm" name="id2601009"></a><pre class="programlisting">int         stringprep_4zi                  (uint32_t *ucs4,
                                             size_t maxucs4len,
                                             <a href="libidn-stringprep.html#Stringprep-profile-flags">Stringprep_profile_flags</a> flags,
                                             const <a href="libidn-stringprep.html#Stringprep-profile">Stringprep_profile</a> *profile);</pre>
<p>
Prepare the input zero terminated UCS-4 string according to the
stringprep profile, and write back the result to the input string.
</p>
<p>
Since the stringprep operation can expand the string, <em class="parameter"><code>maxucs4len</code></em>
indicate how large the buffer holding the string is.  This function
will not read or write to code points outside that size.
</p>
<p>
The <em class="parameter"><code>flags</code></em> are one of <a href="libidn-stringprep.html#Stringprep-profile-flags"><span class="type">Stringprep_profile_flags</span></a> values, or 0.
</p>
<p>
The <em class="parameter"><code>profile</code></em> contain the <a href="libidn-stringprep.html#Stringprep-profile"><span class="type">Stringprep_profile</span></a> instructions to
perform.  Your application can define new profiles, possibly
re-using the generic stringprep tables that always will be part of
the library, or use one of the currently supported profiles.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>ucs4</code></em>&#160;:</span></td>
<td> input/output array with zero terminated string to prepare.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>maxucs4len</code></em>&#160;:</span></td>
<td> maximum length of input/output array.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></td>
<td> a <a href="libidn-stringprep.html#Stringprep-profile-flags"><span class="type">Stringprep_profile_flags</span></a> value, or 0.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>profile</code></em>&#160;:</span></td>
<td> pointer to <a href="libidn-stringprep.html#Stringprep-profile"><span class="type">Stringprep_profile</span></a> to use.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> Returns <a href="libidn-stringprep.html#STRINGPREP-OK:CAPS"><code class="literal">STRINGPREP_OK</code></a> iff successful, or an
  <a href="libidn-stringprep.html#Stringprep-rc"><span class="type">Stringprep_rc</span></a> error code.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2601195"></a><h3>
<a name="stringprep"></a>stringprep ()</h3>
<a class="indexterm" name="id2601206"></a><pre class="programlisting">int         stringprep                      (char *in,
                                             size_t maxlen,
                                             <a href="libidn-stringprep.html#Stringprep-profile-flags">Stringprep_profile_flags</a> flags,
                                             const <a href="libidn-stringprep.html#Stringprep-profile">Stringprep_profile</a> *profile);</pre>
<p>
Prepare the input zero terminated UTF-8 string according to the
stringprep profile, and write back the result to the input string.
</p>
<p>
Note that you must convert strings entered in the systems locale
into UTF-8 before using this function, see
<a href="libidn-stringprep.html#stringprep-locale-to-utf8"><code class="function">stringprep_locale_to_utf8()</code></a>.
</p>
<p>
Since the stringprep operation can expand the string, <em class="parameter"><code>maxlen</code></em>
indicate how large the buffer holding the string is.  This function
will not read or write to characters outside that size.
</p>
<p>
The <em class="parameter"><code>flags</code></em> are one of <a href="libidn-stringprep.html#Stringprep-profile-flags"><span class="type">Stringprep_profile_flags</span></a> values, or 0.
</p>
<p>
The <em class="parameter"><code>profile</code></em> contain the <a href="libidn-stringprep.html#Stringprep-profile"><span class="type">Stringprep_profile</span></a> instructions to
perform.  Your application can define new profiles, possibly
re-using the generic stringprep tables that always will be part of
the library, or use one of the currently supported profiles.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>in</code></em>&#160;:</span></td>
<td> input/ouput array with string to prepare.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>maxlen</code></em>&#160;:</span></td>
<td> maximum length of input/output array.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></td>
<td> a <a href="libidn-stringprep.html#Stringprep-profile-flags"><span class="type">Stringprep_profile_flags</span></a> value, or 0.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>profile</code></em>&#160;:</span></td>
<td> pointer to <a href="libidn-stringprep.html#Stringprep-profile"><span class="type">Stringprep_profile</span></a> to use.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> Returns <a href="libidn-stringprep.html#STRINGPREP-OK:CAPS"><code class="literal">STRINGPREP_OK</code></a> iff successful, or an error code.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2601399"></a><h3>
<a name="stringprep-profile"></a>stringprep_profile ()</h3>
<a class="indexterm" name="id2601410"></a><pre class="programlisting">int         stringprep_profile              (const char *in,
                                             char **out,
                                             const char *profile,
                                             <a href="libidn-stringprep.html#Stringprep-profile-flags">Stringprep_profile_flags</a> flags);</pre>
<p>
Prepare the input zero terminated UTF-8 string according to the
stringprep profile, and return the result in a newly allocated
variable.
</p>
<p>
Note that you must convert strings entered in the systems locale
into UTF-8 before using this function, see
<a href="libidn-stringprep.html#stringprep-locale-to-utf8"><code class="function">stringprep_locale_to_utf8()</code></a>.
</p>
<p>
The output <em class="parameter"><code>out</code></em> variable must be deallocated by the caller.
</p>
<p>
The <em class="parameter"><code>flags</code></em> are one of <a href="libidn-stringprep.html#Stringprep-profile-flags"><span class="type">Stringprep_profile_flags</span></a> values, or 0.
</p>
<p>
The <em class="parameter"><code>profile</code></em> specifies the name of the stringprep profile to use.
It must be one of the internally supported stringprep profiles.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>in</code></em>&#160;:</span></td>
<td> input array with UTF-8 string to prepare.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>out</code></em>&#160;:</span></td>
<td> output variable with pointer to newly allocate string.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>profile</code></em>&#160;:</span></td>
<td> name of stringprep profile to use.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></td>
<td> a <a href="libidn-stringprep.html#Stringprep-profile-flags"><span class="type">Stringprep_profile_flags</span></a> value, or 0.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> Returns <a href="libidn-stringprep.html#STRINGPREP-OK:CAPS"><code class="literal">STRINGPREP_OK</code></a> iff successful, or an error code.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2601588"></a><h3>
<a name="stringprep-strerror"></a>stringprep_strerror ()</h3>
<a class="indexterm" name="id2601598"></a><pre class="programlisting">const char* stringprep_strerror             (<a href="libidn-stringprep.html#Stringprep-rc">Stringprep_rc</a> rc);</pre>
<p>
Convert a return code integer to a text string.  This string can be
used to output a diagnostic message to the user.
</p>
<p>
STRINGPREP_OK: Successful operation.  This value is guaranteed to
  always be zero, the remaining ones are only guaranteed to hold
  non-zero values, for logical comparison purposes.
STRINGPREP_CONTAINS_UNASSIGNED: String contain unassigned Unicode
  code points, which is forbidden by the profile.
STRINGPREP_CONTAINS_PROHIBITED: String contain code points
  prohibited by the profile.
STRINGPREP_BIDI_BOTH_L_AND_RAL: String contain code points with
  conflicting bidirection category.
STRINGPREP_BIDI_LEADTRAIL_NOT_RAL: Leading and trailing character
  in string not of proper bidirectional category.
STRINGPREP_BIDI_CONTAINS_PROHIBITED: Contains prohibited code
  points detected by bidirectional code.
STRINGPREP_TOO_SMALL_BUFFER: Buffer handed to function was too
  small.  This usually indicate a problem in the calling
  application.
STRINGPREP_PROFILE_ERROR: The stringprep profile was inconsistent.
  This usually indicate an internal error in the library.
STRINGPREP_FLAG_ERROR: The supplied flag conflicted with profile.
  This usually indicate a problem in the calling application.
STRINGPREP_UNKNOWN_PROFILE: The supplied profile name was not
  known to the library.
STRINGPREP_NFKC_FAILED: The Unicode NFKC operation failed.  This
  usually indicate an internal error in the library.
STRINGPREP_MALLOC_ERROR: The <code class="function">malloc()</code> was out of memory.  This is
  usually a fatal error.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>rc</code></em>&#160;:</span></td>
<td> a <a href="libidn-stringprep.html#Stringprep-rc"><span class="type">Stringprep_rc</span></a> return code.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> Returns a pointer to a statically allocated string
  containing a description of the error with the return code <em class="parameter"><code>rc</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2601703"></a><h3>
<a name="stringprep-check-version"></a>stringprep_check_version ()</h3>
<a class="indexterm" name="id2601714"></a><pre class="programlisting">const char* stringprep_check_version        (const char *req_version);</pre>
<p>
Check that the the version of the library is at minimum the requested one
and return the version string; return NULL if the condition is not
satisfied.  If a NULL is passed to this function, no check is done,
but the version string is simply returned.
</p>
<p>
See <a href="libidn-stringprep.html#STRINGPREP-VERSION:CAPS"><code class="literal">STRINGPREP_VERSION</code></a> for a suitable <em class="parameter"><code>req_version</code></em> string.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>req_version</code></em>&#160;:</span></td>
<td> Required version number, or NULL.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> Version string of run-time library, or NULL if the
run-time library does not meet the required version number.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2601792"></a><h3>
<a name="stringprep-unichar-to-utf8"></a>stringprep_unichar_to_utf8 ()</h3>
<a class="indexterm" name="id2601803"></a><pre class="programlisting">int         stringprep_unichar_to_utf8      (uint32_t c,
                                             char *outbuf);</pre>
<p>
Converts a single character to UTF-8.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>c</code></em>&#160;:</span></td>
<td> a ISO10646 character code
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>outbuf</code></em>&#160;:</span></td>
<td> output buffer, must have at least 6 bytes of space.
      If <code class="literal">NULL</code>, the length will be computed and returned
      and nothing will be written to <em class="parameter"><code>outbuf</code></em>.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> number of bytes written.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2601892"></a><h3>
<a name="stringprep-utf8-to-unichar"></a>stringprep_utf8_to_unichar ()</h3>
<a class="indexterm" name="id2601903"></a><pre class="programlisting">uint32_t    stringprep_utf8_to_unichar      (const char *p);</pre>
<p>
Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
If <em class="parameter"><code>p</code></em> does not point to a valid UTF-8 encoded character, results are
undefined.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>p</code></em>&#160;:</span></td>
<td> a pointer to Unicode character encoded as UTF-8
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> the resulting character.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2601965"></a><h3>
<a name="stringprep-utf8-to-ucs4"></a>stringprep_utf8_to_ucs4 ()</h3>
<a class="indexterm" name="id2601975"></a><pre class="programlisting">uint32_t*   stringprep_utf8_to_ucs4         (const char *str,
                                             ssize_t len,
                                             size_t *items_written);</pre>
<p>
Convert a string from UTF-8 to a 32-bit fixed width
representation as UCS-4, assuming valid UTF-8 input.
This function does no error checking on the input.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>str</code></em>&#160;:</span></td>
<td> a UTF-8 encoded string
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>len</code></em>&#160;:</span></td>
<td> the maximum length of <em class="parameter"><code>str</code></em> to use. If <em class="parameter"><code>len</code></em> &lt; 0, then
      the string is nul-terminated.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>items_written</code></em>&#160;:</span></td>
<td> location to store the number of characters in the
                result, or <code class="literal">NULL</code>.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a pointer to a newly allocated UCS-4 string.
              This value must be freed with <code class="function">free()</code>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2602100"></a><h3>
<a name="stringprep-ucs4-to-utf8"></a>stringprep_ucs4_to_utf8 ()</h3>
<a class="indexterm" name="id2602111"></a><pre class="programlisting">char*       stringprep_ucs4_to_utf8         (const uint32_t *str,
                                             ssize_t len,
                                             size_t *items_read,
                                             size_t *items_written);</pre>
<p>
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.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>str</code></em>&#160;:</span></td>
<td> a UCS-4 encoded string
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>len</code></em>&#160;:</span></td>
<td> the maximum length of <em class="parameter"><code>str</code></em> to use. If <em class="parameter"><code>len</code></em> &lt; 0, then
      the string is terminated with a 0 character.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>items_read</code></em>&#160;:</span></td>
<td> location to store number of characters read read, or <code class="literal">NULL</code>.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>items_written</code></em>&#160;:</span></td>
<td> location to store number of bytes written or <code class="literal">NULL</code>.
                The value here stored does not include the trailing 0
                byte.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a pointer to a newly allocated UTF-8 string.
              This value must be freed with <code class="function">free()</code>. If an
              error occurs, <code class="literal">NULL</code> will be returned and
              <em class="parameter"><code>error</code></em> set.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2602280"></a><h3>
<a name="stringprep-utf8-nfkc-normalize"></a>stringprep_utf8_nfkc_normalize ()</h3>
<a class="indexterm" name="id2602292"></a><pre class="programlisting">char*       stringprep_utf8_nfkc_normalize  (const char *str,
                                             ssize_t len);</pre>
<p>
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.
</p>
<p>
The normalization mode is NFKC (ALL COMPOSE).  It standardizes
differences that do not affect the text content, such as the
above-mentioned accent representation. It 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. It returns a result with
composed forms rather than a maximally decomposed form.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>str</code></em>&#160;:</span></td>
<td> a UTF-8 encoded string.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>len</code></em>&#160;:</span></td>
<td> length of <em class="parameter"><code>str</code></em>, in bytes, or -1 if <em class="parameter"><code>str</code></em> is nul-terminated.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a newly allocated string, that is the
  NFKC normalized form of <em class="parameter"><code>str</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2602397"></a><h3>
<a name="stringprep-ucs4-nfkc-normalize"></a>stringprep_ucs4_nfkc_normalize ()</h3>
<a class="indexterm" name="id2602409"></a><pre class="programlisting">uint32_t*   stringprep_ucs4_nfkc_normalize  (uint32_t *str,
                                             ssize_t len);</pre>
<p>
Converts UCS4 string into UTF-8 and runs
<a href="libidn-stringprep.html#stringprep-utf8-nfkc-normalize"><code class="function">stringprep_utf8_nfkc_normalize()</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>str</code></em>&#160;:</span></td>
<td> a Unicode string.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>len</code></em>&#160;:</span></td>
<td> length of <em class="parameter"><code>str</code></em> array, or -1 if <em class="parameter"><code>str</code></em> is nul-terminated.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a newly allocated Unicode string, that is the NFKC
  normalized form of <em class="parameter"><code>str</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2602519"></a><h3>
<a name="stringprep-locale-charset"></a>stringprep_locale_charset ()</h3>
<a class="indexterm" name="id2602533"></a><pre class="programlisting">const char* stringprep_locale_charset       (void);</pre>
<p>
Find out current locale charset.  The function respect the CHARSET
environment variable, but typically uses nl_langinfo(CODESET) when
it is supported.  It fall back on "ASCII" if CHARSET isn't set and
nl_langinfo isn't supported or return anything.
</p>
<p>
Note that this function return the application's locale's preferred
charset (or thread's locale's preffered charset, if your system
support thread-specific locales).  It does not return what the
system may be using.  Thus, if you receive data from external
sources you cannot in general use this function to guess what
charset it is encoded in.  Use stringprep_convert from the external
representation into the charset returned by this function, to have
data in the locale encoding.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> Return the character set used by the current locale.
  It will never return NULL, but use "ASCII" as a fallback.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2602591"></a><h3>
<a name="stringprep-convert"></a>stringprep_convert ()</h3>
<a class="indexterm" name="id2602604"></a><pre class="programlisting">char*       stringprep_convert              (const char *str,
                                             const char *to_codeset,
                                             const char *from_codeset);</pre>
<p>
Convert the string from one character set to another using the
system's <code class="function">iconv()</code> function.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>str</code></em>&#160;:</span></td>
<td> input zero-terminated string.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>to_codeset</code></em>&#160;:</span></td>
<td> name of destination character set.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>from_codeset</code></em>&#160;:</span></td>
<td> name of origin character set, as used by <em class="parameter"><code>str</code></em>.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> Returns newly allocated zero-terminated string which
  is <em class="parameter"><code>str</code></em> transcoded into to_codeset.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2602732"></a><h3>
<a name="stringprep-locale-to-utf8"></a>stringprep_locale_to_utf8 ()</h3>
<a class="indexterm" name="id2602746"></a><pre class="programlisting">char*       stringprep_locale_to_utf8       (const char *str);</pre>
<p>
Convert string encoded in the locale's character set into UTF-8 by
using <a href="libidn-stringprep.html#stringprep-convert"><code class="function">stringprep_convert()</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>str</code></em>&#160;:</span></td>
<td> input zero terminated string.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> Returns newly allocated zero-terminated string which
  is <em class="parameter"><code>str</code></em> transcoded into UTF-8.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2602824"></a><h3>
<a name="stringprep-utf8-to-locale"></a>stringprep_utf8_to_locale ()</h3>
<a class="indexterm" name="id2602838"></a><pre class="programlisting">char*       stringprep_utf8_to_locale       (const char *str);</pre>
<p>
Convert string encoded in UTF-8 into the locale's character set by
using <a href="libidn-stringprep.html#stringprep-convert"><code class="function">stringprep_convert()</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>str</code></em>&#160;:</span></td>
<td> input zero terminated string.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> Returns newly allocated zero-terminated string which
  is <em class="parameter"><code>str</code></em> transcoded into the locale's character set.
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>