glib-character-set-conversion.html

来自「最新gtk中文资料集」· HTML 代码 · 共 1,101 行 · 第 1/5 页

HTML
1,101
字号
<p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>opsysstring</code></em>&#160;:</span></p></td><td>   a string in the encoding of the current locale. On Windows                this means the system codepage.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>len</code></em>&#160;:</span></p></td><td>           the length of the string, or -1 if the string is                nul-terminated<sup>[<a href="glib-Character-Set-Conversion.html#ftn.nul-unsafe" class="footnoteref">1</a>]</sup>. </td></tr><tr><td><p><span class="term"><em class="parameter"><code>bytes_read</code></em>&#160;:</span></p></td><td>    location to store the number of bytes in the                input string that were successfully converted, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.                Even if the conversion was successful, this may be                 less than <em class="parameter"><code>len</code></em> if there were partial characters                at the end of the input. If the error                <a class="link" href="glib-Character-Set-Conversion.html#G-CONVERT-ERROR-ILLEGAL-SEQUENCE:CAPS"><span class="type">G_CONVERT_ERROR_ILLEGAL_SEQUENCE</span></a> occurs, the value                stored will the byte offset after the last valid                input sequence.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>bytes_written</code></em>&#160;:</span></p></td><td> the number of bytes stored in the output buffer (not                 including the terminating nul).</td></tr><tr><td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td><td>         location to store the error occuring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore                errors. Any of the errors in <a class="link" href="glib-Character-Set-Conversion.html#GConvertError"><span class="type">GConvertError</span></a> may occur.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> The converted string, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on an error.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2991689"></a><h3><a name="g-filename-to-utf8"></a>g_filename_to_utf8 ()</h3><a class="indexterm" name="id2991703"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              g_filename_to_utf8                  (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *opsysstring,                                                         <a class="link" href="glib-Basic-Types.html#gssize">gssize</a> len,                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *bytes_read,                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *bytes_written,                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>Converts a string which is in the encoding used by GLib forfilenames into a UTF-8 string. Note that on Windows GLib uses UTF-8for filenames; on other platforms, this function indirectly depends on the <a class="link" href="glib-running.html#setlocale" title="Locale">current locale</a>.</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>opsysstring</code></em>&#160;:</span></p></td><td>   a string in the encoding for filenames</td></tr><tr><td><p><span class="term"><em class="parameter"><code>len</code></em>&#160;:</span></p></td><td>           the length of the string, or -1 if the string is                nul-terminated<sup>[<a href="glib-Character-Set-Conversion.html#ftn.nul-unsafe" class="footnoteref">1</a>]</sup>. </td></tr><tr><td><p><span class="term"><em class="parameter"><code>bytes_read</code></em>&#160;:</span></p></td><td>    location to store the number of bytes in the                input string that were successfully converted, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.                Even if the conversion was successful, this may be                 less than <em class="parameter"><code>len</code></em> if there were partial characters                at the end of the input. If the error                <a class="link" href="glib-Character-Set-Conversion.html#G-CONVERT-ERROR-ILLEGAL-SEQUENCE:CAPS"><span class="type">G_CONVERT_ERROR_ILLEGAL_SEQUENCE</span></a> occurs, the value                stored will the byte offset after the last valid                input sequence.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>bytes_written</code></em>&#160;:</span></p></td><td> the number of bytes stored in the output buffer (not                 including the terminating nul).</td></tr><tr><td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td><td>         location to store the error occuring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore                errors. Any of the errors in <a class="link" href="glib-Character-Set-Conversion.html#GConvertError"><span class="type">GConvertError</span></a> may occur.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> The converted string, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on an error.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2991931"></a><h3><a name="g-filename-from-utf8"></a>g_filename_from_utf8 ()</h3><a class="indexterm" name="id2991945"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              g_filename_from_utf8                (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *utf8string,                                                         <a class="link" href="glib-Basic-Types.html#gssize">gssize</a> len,                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *bytes_read,                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *bytes_written,                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>Converts a string from UTF-8 to the encoding GLib uses forfilenames. Note that on Windows GLib uses UTF-8 for filenames;on other platforms, this function indirectly depends on the <a class="link" href="glib-running.html#setlocale" title="Locale">current locale</a>.</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>utf8string</code></em>&#160;:</span></p></td><td>    a UTF-8 encoded string.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>len</code></em>&#160;:</span></p></td><td>           the length of the string, or -1 if the string is                nul-terminated.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>bytes_read</code></em>&#160;:</span></p></td><td>    location to store the number of bytes in the                input string that were successfully converted, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.                Even if the conversion was successful, this may be                 less than <em class="parameter"><code>len</code></em> if there were partial characters                at the end of the input. If the error                <a class="link" href="glib-Character-Set-Conversion.html#G-CONVERT-ERROR-ILLEGAL-SEQUENCE:CAPS"><span class="type">G_CONVERT_ERROR_ILLEGAL_SEQUENCE</span></a> occurs, the value                stored will the byte offset after the last valid                input sequence.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>bytes_written</code></em>&#160;:</span></p></td><td> the number of bytes stored in the output buffer (not                 including the terminating nul).</td></tr><tr><td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td><td>         location to store the error occuring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore                errors. Any of the errors in <a class="link" href="glib-Character-Set-Conversion.html#GConvertError"><span class="type">GConvertError</span></a> may occur.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> The converted string, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on an error.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2992168"></a><h3><a name="g-filename-from-uri"></a>g_filename_from_uri ()</h3><a class="indexterm" name="id2992182"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              g_filename_from_uri                 (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *uri,                                                         <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> **hostname,                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>Converts an escaped ASCII-encoded URI to a local filename in theencoding used for filenames.</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>uri</code></em>&#160;:</span></p></td><td> a uri describing a filename (escaped, encoded in ASCII).</td></tr><tr><td><p><span class="term"><em class="parameter"><code>hostname</code></em>&#160;:</span></p></td><td> Location to store hostname for the URI, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.           If there is no hostname in the URI, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> will be           stored in this location.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td><td> location to store the error occuring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore        errors. Any of the errors in <a class="link" href="glib-Character-Set-Conversion.html#GConvertError"><span class="type">GConvertError</span></a> may occur.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> a newly-allocated string holding the resulting              filename, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on an error.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en">

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?