Debian Codegraph @

docs/html/redland-unicode.html

raw symbols SCIP
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Unicode</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="Redland RDF Library Manual">
8 <link rel="up" href="reference-manual.html" title="Part II. Reference Manual">
9 <link rel="prev" href="redland-stream.html" title="Stream of triples (#librdf_statement).">
10 <link rel="next" href="redland-uri.html" title="URI">
11 <meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
16 <tr valign="middle">
17 <td><a accesskey="p" href="redland-stream.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18 <td><a accesskey="u" href="reference-manual.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20 <th width="100%" align="center">Redland RDF Library Manual</th>
21 <td><a accesskey="n" href="redland-uri.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
22 </tr>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#redland-unicode.synopsis" class="shortcut">Top</a>
25  | 
26 <a href="#redland-unicode.description" class="shortcut">Description</a>
27 </td></tr>
28 </table>
29 <div class="refentry">
30 <a name="redland-unicode"></a><div class="titlepage"></div>
31 <div class="refnamediv"><table width="100%"><tr>
32 <td valign="top">
33 <h2><span class="refentrytitle"><a name="redland-unicode.top_of_page"></a>Unicode</span></h2>
34 <p>Unicode — Unicode utility functions.</p>
35 </td>
36 <td valign="top" align="right"></td>
37 </tr></table></div>
38 <div class="refsynopsisdiv">
39 <a name="redland-unicode.synopsis"></a><h2>Synopsis</h2>
40 <pre class="synopsis">typedef <a class="link" href="redland-unicode.html#librdf-unichar" title="librdf_unichar">librdf_unichar</a>;
41 <span class="returnvalue">int</span> <a class="link" href="redland-unicode.html#librdf-unicode-char-to-utf8" title="librdf_unicode_char_to_utf8 ()">librdf_unicode_char_to_utf8</a> (<em class="parameter"><code><a class="link" href="redland-unicode.html#librdf-unichar" title="librdf_unichar"><span class="type">librdf_unichar</span></a> c</code></em>,
42 <em class="parameter"><code>unsigned <span class="type">char</span> *output</code></em>,
43 <em class="parameter"><code><span class="type">int</span> length</code></em>);
44 <span class="returnvalue">int</span> <a class="link" href="redland-unicode.html#librdf-utf8-to-unicode-char" title="librdf_utf8_to_unicode_char ()">librdf_utf8_to_unicode_char</a> (<em class="parameter"><code><a class="link" href="redland-unicode.html#librdf-unichar" title="librdf_unichar"><span class="type">librdf_unichar</span></a> *output</code></em>,
45 <em class="parameter"><code>const unsigned <span class="type">char</span> *input</code></em>,
46 <em class="parameter"><code><span class="type">int</span> length</code></em>);
47 unsigned <span class="returnvalue">char</span> * <a class="link" href="redland-unicode.html#librdf-utf8-to-latin1" title="librdf_utf8_to_latin1 ()">librdf_utf8_to_latin1</a> (<em class="parameter"><code>const unsigned <span class="type">char</span> *input</code></em>,
48 <em class="parameter"><code><span class="type">int</span> length</code></em>,
49 <em class="parameter"><code><span class="type">int</span> *output_length</code></em>);
50 unsigned <span class="returnvalue">char</span> * <a class="link" href="redland-unicode.html#librdf-utf8-to-latin1-2" title="librdf_utf8_to_latin1_2 ()">librdf_utf8_to_latin1_2</a> (<em class="parameter"><code>const unsigned <span class="type">char</span> *input</code></em>,
51 <em class="parameter"><code><span class="type">size_t</span> length</code></em>,
52 <em class="parameter"><code>unsigned <span class="type">char</span> discard</code></em>,
53 <em class="parameter"><code><span class="type">size_t</span> *output_length</code></em>);
54 unsigned <span class="returnvalue">char</span> * <a class="link" href="redland-unicode.html#librdf-latin1-to-utf8" title="librdf_latin1_to_utf8 ()">librdf_latin1_to_utf8</a> (<em class="parameter"><code>const unsigned <span class="type">char</span> *input</code></em>,
55 <em class="parameter"><code><span class="type">int</span> length</code></em>,
56 <em class="parameter"><code><span class="type">int</span> *output_length</code></em>);
57 unsigned <span class="returnvalue">char</span> * <a class="link" href="redland-unicode.html#librdf-latin1-to-utf8-2" title="librdf_latin1_to_utf8_2 ()">librdf_latin1_to_utf8_2</a> (<em class="parameter"><code>const unsigned <span class="type">char</span> *input</code></em>,
58 <em class="parameter"><code><span class="type">size_t</span> length</code></em>,
59 <em class="parameter"><code><span class="type">size_t</span> *output_length</code></em>);
60 <span class="returnvalue">void</span> <a class="link" href="redland-unicode.html#librdf-utf8-print" title="librdf_utf8_print ()">librdf_utf8_print</a> (<em class="parameter"><code>const unsigned <span class="type">char</span> *input</code></em>,
61 <em class="parameter"><code><span class="type">int</span> length</code></em>,
62 <em class="parameter"><code><span class="type">FILE</span> *stream</code></em>);
63 </pre>
64 </div>
65 <div class="refsect1">
66 <a name="redland-unicode.description"></a><h2>Description</h2>
67 <p>
68 Utility functions to convert between UTF-8, full Unicode and Latin-1.
69 Redland uses UTF-8 for all string formats (except where noted) but
70 these may need to be converted to other Unicode encodings or downgraded
71 with loss to Latin-1.
72 </p>
73 </div>
74 <div class="refsect1">
75 <a name="redland-unicode.details"></a><h2>Details</h2>
76 <div class="refsect2">
77 <a name="librdf-unichar"></a><h3>librdf_unichar</h3>
78 <pre class="programlisting">typedef raptor_unichar librdf_unichar;
79 </pre>
80 <p>
81 Unicode codepoint.
82 </p>
83 </div>
84 <hr>
85 <div class="refsect2">
86 <a name="librdf-unicode-char-to-utf8"></a><h3>librdf_unicode_char_to_utf8 ()</h3>
87 <pre class="programlisting"><span class="returnvalue">int</span> librdf_unicode_char_to_utf8 (<em class="parameter"><code><a class="link" href="redland-unicode.html#librdf-unichar" title="librdf_unichar"><span class="type">librdf_unichar</span></a> c</code></em>,
88 <em class="parameter"><code>unsigned <span class="type">char</span> *output</code></em>,
89 <em class="parameter"><code><span class="type">int</span> length</code></em>);</pre>
90 <p>
91 Convert a Unicode character to UTF-8 encoding.
92 </p>
93 <p>
94 <em class="parameter"><code>deprecated</code></em>: Use <code class="function">raptor_unicode_utf8_string_put_char()</code> noting that
95 the length argument is a size_t.
96 </p>
97 <p>
98 If buffer is NULL, then will calculate the length rather than
99 perform it. This can be used by the caller to allocate space
100 and then re-call this function with the new buffer.
101 </p>
102 <div class="variablelist"><table border="0">
103 <col align="left" valign="top">
104 <tbody>
105 <tr>
106 <td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
107 <td>Unicode character</td>
108 </tr>
109 <tr>
110 <td><p><span class="term"><em class="parameter"><code>output</code></em> :</span></p></td>
111 <td>UTF-8 string buffer or NULL</td>
112 </tr>
113 <tr>
114 <td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
115 <td>buffer size (will be truncated to size_t)</td>
116 </tr>
117 <tr>
118 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
119 <td>bytes written to output buffer or &lt;0 on failure</td>
120 </tr>
121 </tbody>
122 </table></div>
123 </div>
124 <hr>
125 <div class="refsect2">
126 <a name="librdf-utf8-to-unicode-char"></a><h3>librdf_utf8_to_unicode_char ()</h3>
127 <pre class="programlisting"><span class="returnvalue">int</span> librdf_utf8_to_unicode_char (<em class="parameter"><code><a class="link" href="redland-unicode.html#librdf-unichar" title="librdf_unichar"><span class="type">librdf_unichar</span></a> *output</code></em>,
128 <em class="parameter"><code>const unsigned <span class="type">char</span> *input</code></em>,
129 <em class="parameter"><code><span class="type">int</span> length</code></em>);</pre>
130 <p>
131 Convert an UTF-8 encoded buffer to a Unicode character.
132 </p>
133 <p>
134 <em class="parameter"><code>deprecated</code></em>: Use <code class="function">raptor_unicode_utf8_string_get_char()</code> noting that
135 the arg order has changed to input, length (a size_t), output.
136 </p>
137 <p>
138 If <em class="parameter"><code>output</code></em> is NULL, then will calculate the number of bytes that
139 will be used from the input buffer and not perform the conversion.
140 </p>
141 <div class="variablelist"><table border="0">
142 <col align="left" valign="top">
143 <tbody>
144 <tr>
145 <td><p><span class="term"><em class="parameter"><code>output</code></em> :</span></p></td>
146 <td>Pointer to the Unicode character or NULL</td>
147 </tr>
148 <tr>
149 <td><p><span class="term"><em class="parameter"><code>input</code></em> :</span></p></td>
150 <td>UTF-8 string buffer</td>
151 </tr>
152 <tr>
153 <td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
154 <td>buffer size (will be truncated to size_t)</td>
155 </tr>
156 <tr>
157 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
158 <td>bytes used from input buffer or &lt;0 on failure</td>
159 </tr>
160 </tbody>
161 </table></div>
162 </div>
163 <hr>
164 <div class="refsect2">
165 <a name="librdf-utf8-to-latin1"></a><h3>librdf_utf8_to_latin1 ()</h3>
166 <pre class="programlisting">unsigned <span class="returnvalue">char</span> * librdf_utf8_to_latin1 (<em class="parameter"><code>const unsigned <span class="type">char</span> *input</code></em>,
167 <em class="parameter"><code><span class="type">int</span> length</code></em>,
168 <em class="parameter"><code><span class="type">int</span> *output_length</code></em>);</pre>
169 <p>
170 Convert a UTF-8 string to ISO Latin-1.
171 </p>
172 <p>
173 Converts the given UTF-8 string to the ISO Latin-1 subset of
174 Unicode (characters 0x00-0xff), discarding any out of range
175 characters.
176 </p>
177 <p>
178 <em class="parameter"><code>deprecated</code></em> for <a class="link" href="redland-unicode.html#librdf-utf8-to-latin1-2" title="librdf_utf8_to_latin1_2 ()"><code class="function">librdf_utf8_to_latin1_2()</code></a> that takes and returns
179 size_t sizes and allows replacing of out of range characters.
180 </p>
181 <p>
182 If <em class="parameter"><code>output_length</code></em> is not NULL, the returned string length
183 will be stored there.
184 </p>
185 <div class="variablelist"><table border="0">
186 <col align="left" valign="top">
187 <tbody>
188 <tr>
189 <td><p><span class="term"><em class="parameter"><code>input</code></em> :</span></p></td>
190 <td>UTF-8 string buffer</td>
191 </tr>
192 <tr>
193 <td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
194 <td>buffer size (will be truncated to size_t)</td>
195 </tr>
196 <tr>
197 <td><p><span class="term"><em class="parameter"><code>output_length</code></em> :</span></p></td>
198 <td>Pointer to variable to store resulting string length or NULL</td>
199 </tr>
200 <tr>
201 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
202 <td>pointer to new ISO Latin-1 string or NULL on failure</td>
203 </tr>
204 </tbody>
205 </table></div>
206 </div>
207 <hr>
208 <div class="refsect2">
209 <a name="librdf-utf8-to-latin1-2"></a><h3>librdf_utf8_to_latin1_2 ()</h3>
210 <pre class="programlisting">unsigned <span class="returnvalue">char</span> * librdf_utf8_to_latin1_2 (<em class="parameter"><code>const unsigned <span class="type">char</span> *input</code></em>,
211 <em class="parameter"><code><span class="type">size_t</span> length</code></em>,
212 <em class="parameter"><code>unsigned <span class="type">char</span> discard</code></em>,
213 <em class="parameter"><code><span class="type">size_t</span> *output_length</code></em>);</pre>
214 <p>
215 Convert a UTF-8 string to ISO Latin-1.
216 </p>
217 <p>
218 Converts the given UTF-8 string to the ISO Latin-1 subset of
219 Unicode (characters 0x00-0xff). Out of range characters are
220 replaced with <em class="parameter"><code>discard</code></em> unless it is NUL (\0).
221 </p>
222 <p>
223 If <em class="parameter"><code>output_length</code></em> is not NULL, the returned string length will be
224 stored there.
225 </p>
226 <div class="variablelist"><table border="0">
227 <col align="left" valign="top">
228 <tbody>
229 <tr>
230 <td><p><span class="term"><em class="parameter"><code>input</code></em> :</span></p></td>
231 <td>UTF-8 string buffer</td>
232 </tr>
233 <tr>
234 <td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
235 <td>buffer size</td>
236 </tr>
237 <tr>
238 <td><p><span class="term"><em class="parameter"><code>discard</code></em> :</span></p></td>
239 <td>character to use to replace out of range characters or NUL (\0) to discard</td>
240 </tr>
241 <tr>
242 <td><p><span class="term"><em class="parameter"><code>output_length</code></em> :</span></p></td>
243 <td>Pointer to variable to store resulting string length or NULL</td>
244 </tr>
245 <tr>
246 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
247 <td>pointer to new ISO Latin-1 string or NULL on failure</td>
248 </tr>
249 </tbody>
250 </table></div>
251 </div>
252 <hr>
253 <div class="refsect2">
254 <a name="librdf-latin1-to-utf8"></a><h3>librdf_latin1_to_utf8 ()</h3>
255 <pre class="programlisting">unsigned <span class="returnvalue">char</span> * librdf_latin1_to_utf8 (<em class="parameter"><code>const unsigned <span class="type">char</span> *input</code></em>,
256 <em class="parameter"><code><span class="type">int</span> length</code></em>,
257 <em class="parameter"><code><span class="type">int</span> *output_length</code></em>);</pre>
258 <p>
259 Convert an ISO Latin-1 encoded string to UTF-8.
260 </p>
261 <p>
262 Converts the given ISO Latin-1 string to an UTF-8 encoded string
263 representing the same content. This is lossless.
264 </p>
265 <p>
266 <em class="parameter"><code>deprecated</code></em> for <a class="link" href="redland-unicode.html#librdf-latin1-to-utf8-2" title="librdf_latin1_to_utf8_2 ()"><code class="function">librdf_latin1_to_utf8_2()</code></a> that takes and returns
267 size_t sizes.
268 </p>
269 <p>
270 If <em class="parameter"><code>output_length</code></em> is not NULL, the returned string length will be
271 stored there.
272 </p>
273 <div class="variablelist"><table border="0">
274 <col align="left" valign="top">
275 <tbody>
276 <tr>
277 <td><p><span class="term"><em class="parameter"><code>input</code></em> :</span></p></td>
278 <td>ISO Latin-1 string buffer</td>
279 </tr>
280 <tr>
281 <td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
282 <td>buffer size (will be truncated to size_t)</td>
283 </tr>
284 <tr>
285 <td><p><span class="term"><em class="parameter"><code>output_length</code></em> :</span></p></td>
286 <td>Pointer to variable to store resulting string length or NULL</td>
287 </tr>
288 <tr>
289 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
290 <td>pointer to new UTF-8 string or NULL on failure</td>
291 </tr>
292 </tbody>
293 </table></div>
294 </div>
295 <hr>
296 <div class="refsect2">
297 <a name="librdf-latin1-to-utf8-2"></a><h3>librdf_latin1_to_utf8_2 ()</h3>
298 <pre class="programlisting">unsigned <span class="returnvalue">char</span> * librdf_latin1_to_utf8_2 (<em class="parameter"><code>const unsigned <span class="type">char</span> *input</code></em>,
299 <em class="parameter"><code><span class="type">size_t</span> length</code></em>,
300 <em class="parameter"><code><span class="type">size_t</span> *output_length</code></em>);</pre>
301 <p>
302 Convert an ISO Latin-1 encoded string to UTF-8.
303 </p>
304 <p>
305 Converts the given ISO Latin-1 string to an UTF-8 encoded string
306 representing the same content. This is lossless.
307 </p>
308 <p>
309 If <em class="parameter"><code>output_length</code></em> is not NULL, the returned string length will be
310 stored there.
311 </p>
312 <div class="variablelist"><table border="0">
313 <col align="left" valign="top">
314 <tbody>
315 <tr>
316 <td><p><span class="term"><em class="parameter"><code>input</code></em> :</span></p></td>
317 <td>ISO Latin-1 string buffer</td>
318 </tr>
319 <tr>
320 <td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
321 <td>buffer size</td>
322 </tr>
323 <tr>
324 <td><p><span class="term"><em class="parameter"><code>output_length</code></em> :</span></p></td>
325 <td>Pointer to variable to store resulting string length or NULL</td>
326 </tr>
327 <tr>
328 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
329 <td>pointer to new UTF-8 string or NULL on failure</td>
330 </tr>
331 </tbody>
332 </table></div>
333 </div>
334 <hr>
335 <div class="refsect2">
336 <a name="librdf-utf8-print"></a><h3>librdf_utf8_print ()</h3>
337 <pre class="programlisting"><span class="returnvalue">void</span> librdf_utf8_print (<em class="parameter"><code>const unsigned <span class="type">char</span> *input</code></em>,
338 <em class="parameter"><code><span class="type">int</span> length</code></em>,
339 <em class="parameter"><code><span class="type">FILE</span> *stream</code></em>);</pre>
340 <p>
341 Print a UTF-8 string to a stream.
342 </p>
343 <p>
344 Pretty prints the UTF-8 string in a pseudo-C character
345 format like \u<span class="emphasis"><em>hex digits</em></span> when the characters fail
346 the <code class="function">isprint()</code> test.
347 </p>
348 <div class="variablelist"><table border="0">
349 <col align="left" valign="top">
350 <tbody>
351 <tr>
352 <td><p><span class="term"><em class="parameter"><code>input</code></em> :</span></p></td>
353 <td>UTF-8 string buffer</td>
354 </tr>
355 <tr>
356 <td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
357 <td>buffer size (will be truncated to size_t)</td>
358 </tr>
359 <tr>
360 <td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
361 <td>FILE* stream</td>
362 </tr>
363 </tbody>
364 </table></div>
365 </div>
366 </div>
367 </div>
368 <div class="footer">
369 <hr>
370 Generated by GTK-Doc V1.18</div>
371 </body>
372 </html>