1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-07 23:52:32 +02:00
audacity/lib-src/redland/docs/html/redland-unicode.html
2010-01-24 09:19:39 +00:00

303 lines
12 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Unicode</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
<link rel="start" href="index.html" title="Redland RDF Library Manual">
<link rel="up" href="reference-manual.html" title="Part II. Reference Manual">
<link rel="prev" href="redland-stream.html" title="Stream of triples (#librdf_statement).">
<link rel="next" href="redland-uri.html" title="URI">
<meta name="generator" content="GTK-Doc V1.10 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="redland.html" title="Redland Overview">
<link rel="chapter" href="introduction.html" title="Introduction">
<link rel="part" href="tutorial.html" title="Part I. Tutorial">
<link rel="part" href="reference-manual.html" title="Part II. Reference Manual">
<link rel="chapter" href="objects.html" title="Objects in C">
<link rel="chapter" href="redland-storage-modules.html" title="Storage Modules">
<link rel="index" href="indexes.html" title="Index">
</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="redland-stream.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="reference-manual.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">Redland RDF Library Manual</th>
<td><a accesskey="n" href="redland-uri.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#redland-unicode.synopsis" class="shortcut">Top</a>
 | 
<a href="#redland-unicode.description" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="redland-unicode"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="redland-unicode.top_of_page"></a>Unicode</span></h2>
<p>Unicode — Unicode utility functions.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="redland-unicode.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
typedef <a class="link" href="redland-unicode.html#librdf-unichar" title="librdf_unichar">librdf_unichar</a>;
int <a class="link" href="redland-unicode.html#librdf-unicode-char-to-utf8" title="librdf_unicode_char_to_utf8 ()">librdf_unicode_char_to_utf8</a> (<a class="link" href="redland-unicode.html#librdf-unichar" title="librdf_unichar">librdf_unichar</a> c,
byte *output,
int length);
int <a class="link" href="redland-unicode.html#librdf-utf8-to-unicode-char" title="librdf_utf8_to_unicode_char ()">librdf_utf8_to_unicode_char</a> (<a class="link" href="redland-unicode.html#librdf-unichar" title="librdf_unichar">librdf_unichar</a> *output,
const byte *input,
int length);
byte* <a class="link" href="redland-unicode.html#librdf-utf8-to-latin1" title="librdf_utf8_to_latin1 ()">librdf_utf8_to_latin1</a> (const byte *input,
int length,
int *output_length);
byte* <a class="link" href="redland-unicode.html#librdf-latin1-to-utf8" title="librdf_latin1_to_utf8 ()">librdf_latin1_to_utf8</a> (const byte *input,
int length,
int *output_length);
void <a class="link" href="redland-unicode.html#librdf-utf8-print" title="librdf_utf8_print ()">librdf_utf8_print</a> (const byte *input,
int length,
FILE *stream);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="redland-unicode.description"></a><h2>Description</h2>
<p>
Utility functions to convert between UTF-8, full Unicode and Latin-1.
Redland uses UTF-8 for all string formats (except where noted) but
these may need to be converted to other Unicode encodings or downgraded
with loss to Latin-1.
</p>
</div>
<div class="refsect1" lang="en">
<a name="redland-unicode.details"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="librdf-unichar"></a><h3>librdf_unichar</h3>
<pre class="programlisting">typedef u32 librdf_unichar;
</pre>
<p>
Unicode codepoint.</p>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="librdf-unicode-char-to-utf8"></a><h3>librdf_unicode_char_to_utf8 ()</h3>
<pre class="programlisting">int librdf_unicode_char_to_utf8 (<a class="link" href="redland-unicode.html#librdf-unichar" title="librdf_unichar">librdf_unichar</a> c,
byte *output,
int length);</pre>
<p>
Convert a Unicode character to UTF-8 encoding.
</p>
<p>
If buffer is NULL, then will calculate the length rather than
perform it. This can be used by the caller to allocate space
and then re-call this function with the new buffer.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td> Unicode character
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>output</code></em> :</span></p></td>
<td> UTF-8 string buffer or NULL
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
<td> buffer size
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> bytes written to output buffer or &lt;0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="librdf-utf8-to-unicode-char"></a><h3>librdf_utf8_to_unicode_char ()</h3>
<pre class="programlisting">int librdf_utf8_to_unicode_char (<a class="link" href="redland-unicode.html#librdf-unichar" title="librdf_unichar">librdf_unichar</a> *output,
const byte *input,
int length);</pre>
<p>
Convert an UTF-8 encoded buffer to a Unicode character.
</p>
<p>
If output is NULL, then will calculate the number of bytes that
will be used from the input buffer and not perform the conversion.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>output</code></em> :</span></p></td>
<td> Pointer to the Unicode character or NULL
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>input</code></em> :</span></p></td>
<td> UTF-8 string buffer
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
<td> buffer size
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> bytes used from input buffer or &lt;0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="librdf-utf8-to-latin1"></a><h3>librdf_utf8_to_latin1 ()</h3>
<pre class="programlisting">byte* librdf_utf8_to_latin1 (const byte *input,
int length,
int *output_length);</pre>
<p>
Convert a UTF-8 string to ISO Latin-1.
</p>
<p>
Converts the given UTF-8 string to the ISO Latin-1 subset of
Unicode (characters 0x00-0xff), discarding any out of range
characters.
</p>
<p>
If the output_length pointer is not NULL, the returned string
length will be stored there.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>input</code></em> :</span></p></td>
<td> UTF-8 string buffer
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
<td> buffer size
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>output_length</code></em> :</span></p></td>
<td> Pointer to variable to store resulting string length or NULL
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> pointer to new ISO Latin-1 string or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="librdf-latin1-to-utf8"></a><h3>librdf_latin1_to_utf8 ()</h3>
<pre class="programlisting">byte* librdf_latin1_to_utf8 (const byte *input,
int length,
int *output_length);</pre>
<p>
Convert an ISO Latin-1 encoded string to UTF-8.
</p>
<p>
Converts the given ISO Latin-1 string to an UTF-8 encoded string
representing the same content. This is lossless.
</p>
<p>
If the output_length pointer is not NULL, the returned string
length will be stored there.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>input</code></em> :</span></p></td>
<td> ISO Latin-1 string buffer
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
<td> buffer size
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>output_length</code></em> :</span></p></td>
<td> Pointer to variable to store resulting string length or NULL
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> pointer to new UTF-8 string or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="librdf-utf8-print"></a><h3>librdf_utf8_print ()</h3>
<pre class="programlisting">void librdf_utf8_print (const byte *input,
int length,
FILE *stream);</pre>
<p>
Print a UTF-8 string to a stream.
</p>
<p>
Pretty prints the UTF-8 string in a pseudo-C character
format like \u<span class="emphasis"><em>hex digits</em></span> when the characters fail
the <code class="function">isprint()</code> test.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>input</code></em> :</span></p></td>
<td> UTF-8 string buffer
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
<td> buffer size
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
<td> FILE* stream
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.10</div>
</body>
</html>