/src/wrappers/glib/library/utilities/glib_character_set_conversion.e

http://github.com/tybor/Liberty · Specman e · 570 lines · 76 code · 120 blank · 374 comment · 6 complexity · 88105fb02acffcbdc1c72e0a234787f1 MD5 · raw file

  1. indexing
  2. description: "C string Utility Functions -- various C-string-related functions."
  3. copyright: "[
  4. Copyright (C) 2007 Anthony Lenton, Soluciones Informaticas Libres S.A.,
  5. GLib team
  6. This library is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU Lesser General Public License
  8. as published by the Free Software Foundation; either version 2.1 of
  9. the License, or (at your option) any later version.
  10. This library is distributed in the hopeOA that it will be useful, but
  11. WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. Lesser General Public License for more details.
  14. You should have received a copy of the GNU Lesser General Public
  15. License along with this library; if not, write to the Free Software
  16. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. 02110-1301 USA
  18. ]"
  19. deferred class GLIB_CHARACTER_SET_CONVERSION
  20. feature
  21. gconvert (a_string, to_codeset, from_codeset: STRING): STRING is
  22. -- Converts a string from one character set to another.
  23. -- Note that you should use iconv() for streaming conversions.
  24. -- a_strint : the string to convert
  25. -- to_codeset : name of character set into which to convert str
  26. -- from_codeset : character set of str.
  27. -- Returns : If the conversion was successful, a newly allocated
  28. -- string. Otherwise Result is Void.
  29. local
  30. res_ptr: POINTER
  31. bytes_read, bytes_written: INTEGER
  32. do
  33. res_ptr := g_convert (a_string.to_external, a_string.count, to_codeset.to_external,
  34. from_codeset.to_external, $bytes_read, $bytes_written, default_pointer)
  35. if res_ptr.is_not_null then
  36. create Result.from_external (res_ptr)
  37. end
  38. end
  39. locale_to_utf8 (a_string: STRING): STRING is
  40. -- Converts a string which is in the encoding used for strings by the C runtime
  41. -- (usually the same as that used by the operating system) in the current locale
  42. -- into a UTF-8 string.
  43. -- a_string : a string in the encoding of the current locale. On Windows this
  44. -- means the system codepage.
  45. -- Returns : The converted string, or Void on an error.
  46. local
  47. res_ptr: POINTER
  48. bytes_read, bytes_written: INTEGER
  49. do
  50. res_ptr := g_locale_to_utf8 (a_string.to_external, a_string.count, $bytes_read, $bytes_written, default_pointer)
  51. if res_ptr.is_not_null then
  52. create Result.from_external (res_ptr)
  53. end
  54. end
  55. filename_from_utf8 (an_utf8_string: STRING): STRING is
  56. -- Converts a string from UTF-8 to the encoding GLib uses for filenames. Note that
  57. -- on Windows GLib uses UTF-8 for filenames.
  58. -- an_utf8string : a UTF-8 encoded string.
  59. -- Returns : The converted string, or Void on an error.
  60. local
  61. res_ptr: POINTER
  62. bytes_read, bytes_written: INTEGER
  63. do
  64. res_ptr := g_filename_from_utf8 (an_utf8_string.to_external, an_utf8_string.count, $bytes_read, $bytes_written, default_pointer)
  65. if res_ptr.is_not_null then
  66. create Result.from_external (res_ptr)
  67. end
  68. end
  69. locale_from_utf8 (a_string: STRING): STRING is
  70. -- Converts a string from UTF-8 to the encoding used for strings by the C runtime
  71. -- (usually the same as that used by the operating system) in the current locale.
  72. -- a_string : a UTF-8 encoded string
  73. -- Returns : The converted string, or Void on an error.
  74. local
  75. res_ptr: POINTER
  76. bytes_read, bytes_written: INTEGER
  77. do
  78. res_ptr := g_locale_from_utf8 (a_string.to_external, a_string.count, $bytes_read, $bytes_written, default_pointer)
  79. if res_ptr.is_not_null then
  80. create Result.from_external (res_ptr)
  81. end
  82. end
  83. feature {} -- External calls
  84. g_convert (a_str: POINTER; a_len: INTEGER; to_codeset, from_codeset, bytes_read, bytes_written, error: POINTER): POINTER is
  85. -- Converts a string from one character set to another.
  86. -- Note that you should use g_iconv() for streaming conversions^[2].
  87. -- str : the string to convert
  88. -- len : the length of the string, or -1 if the string is
  89. -- nul-terminated. Note that some encodings may
  90. -- allow nul bytes to occur inside strings. In that
  91. -- case, using -1 for the len parameter is unsafe.
  92. -- to_codeset : name of character set into which to convert str
  93. -- from_codeset : character set of str.
  94. -- bytes_read : location to store the number of bytes in the input string that
  95. -- were successfully converted, or NULL. Even if the conversion was
  96. -- successful, this may be less than len if there were partial
  97. -- characters at the end of the input. If the error
  98. -- G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will
  99. -- the byte offset after the last valid input sequence.
  100. -- bytes_written : the number of bytes stored in the output buffer (not including
  101. -- the terminating nul).
  102. -- error : location to store the error occuring, or NULL to ignore errors.
  103. -- Any of the errors in GConvertError may occur.
  104. -- Returns : If the conversion was successful, a newly allocated
  105. -- nul-terminated string, which must be freed with g_free().
  106. -- Otherwise NULL and error will be set.
  107. external "C use <glib.h>"
  108. end
  109. -- ---------------------------------------------------------------------------------
  110. -- g_convert_with_fallback ()
  111. -- gchar* g_convert_with_fallback (const gchar *str,
  112. -- gssize len,
  113. -- const gchar *to_codeset,
  114. -- const gchar *from_codeset,
  115. -- gchar *fallback,
  116. -- gsize *bytes_read,
  117. -- gsize *bytes_written,
  118. -- GError **error);
  119. -- Converts a string from one character set to another, possibly including fallback
  120. -- sequences for characters not representable in the output. Note that it is not
  121. -- guaranteed that the specification for the fallback sequences in fallback will be
  122. -- honored. Some systems may do a approximate conversion from from_codeset to
  123. -- to_codeset in their iconv() functions, in which case GLib will simply return that
  124. -- approximate conversion.
  125. -- Note that you should use g_iconv() for streaming conversions^[2].
  126. -- str : the string to convert
  127. -- len : the length of the string, or -1 if the string is
  128. -- nul-terminated^[1].
  129. -- to_codeset : name of character set into which to convert str
  130. -- from_codeset : character set of str.
  131. -- fallback : UTF-8 string to use in place of character not present in the
  132. -- target encoding. (The string must be representable in the target
  133. -- encoding). If NULL, characters not in the target encoding will be
  134. -- represented as Unicode escapes \uxxxx or \Uxxxxyyyy.
  135. -- bytes_read : location to store the number of bytes in the input string that
  136. -- were successfully converted, or NULL. Even if the conversion was
  137. -- successful, this may be less than len if there were partial
  138. -- characters at the end of the input.
  139. -- bytes_written : the number of bytes stored in the output buffer (not including
  140. -- the terminating nul).
  141. -- error : location to store the error occuring, or NULL to ignore errors.
  142. -- Any of the errors in GConvertError may occur.
  143. -- Returns : If the conversion was successful, a newly allocated
  144. -- nul-terminated string, which must be freed with g_free().
  145. -- Otherwise NULL and error will be set.
  146. -- ---------------------------------------------------------------------------------
  147. -- GIConv
  148. -- typedef struct _GIConv GIConv;
  149. -- The GIConv struct wraps an iconv() conversion descriptor. It contains private
  150. -- data and should only be accessed using the following functions.
  151. -- ---------------------------------------------------------------------------------
  152. -- g_convert_with_iconv ()
  153. -- gchar* g_convert_with_iconv (const gchar *str,
  154. -- gssize len,
  155. -- GIConv converter,
  156. -- gsize *bytes_read,
  157. -- gsize *bytes_written,
  158. -- GError **error);
  159. -- Converts a string from one character set to another.
  160. -- Note that you should use g_iconv() for streaming conversions^[2].
  161. -- str : the string to convert
  162. -- len : the length of the string, or -1 if the string is
  163. -- nul-terminated^[1].
  164. -- converter : conversion descriptor from g_iconv_open()
  165. -- bytes_read : location to store the number of bytes in the input string that
  166. -- were successfully converted, or NULL. Even if the conversion was
  167. -- successful, this may be less than len if there were partial
  168. -- characters at the end of the input. If the error
  169. -- G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will
  170. -- the byte offset after the last valid input sequence.
  171. -- bytes_written : the number of bytes stored in the output buffer (not including
  172. -- the terminating nul).
  173. -- error : location to store the error occuring, or NULL to ignore errors.
  174. -- Any of the errors in GConvertError may occur.
  175. -- Returns : If the conversion was successful, a newly allocated
  176. -- nul-terminated string, which must be freed with g_free().
  177. -- Otherwise NULL and error will be set.
  178. -- ---------------------------------------------------------------------------------
  179. -- G_CONVERT_ERROR
  180. -- #define G_CONVERT_ERROR g_convert_error_quark()
  181. -- Error domain for character set conversions. Errors in this domain will be from
  182. -- the GConvertError enumeration. See GError for information on error domains.
  183. -- ---------------------------------------------------------------------------------
  184. -- g_iconv_open ()
  185. -- GIConv g_iconv_open (const gchar *to_codeset,
  186. -- const gchar *from_codeset);
  187. -- Same as the standard UNIX routine iconv_open(), but may be implemented via
  188. -- libiconv on UNIX flavors that lack a native implementation.
  189. -- GLib provides g_convert() and g_locale_to_utf8() which are likely more convenient
  190. -- than the raw iconv wrappers.
  191. -- to_codeset : destination codeset
  192. -- from_codeset : source codeset
  193. -- Returns : a "conversion descriptor", or (GIConv)-1 if opening the converter
  194. -- failed.
  195. -- ---------------------------------------------------------------------------------
  196. -- g_iconv ()
  197. -- size_t g_iconv (GIConv converter,
  198. -- gchar **inbuf,
  199. -- gsize *inbytes_left,
  200. -- gchar **outbuf,
  201. -- gsize *outbytes_left);
  202. -- Same as the standard UNIX routine iconv(), but may be implemented via libiconv on
  203. -- UNIX flavors that lack a native implementation.
  204. -- GLib provides g_convert() and g_locale_to_utf8() which are likely more convenient
  205. -- than the raw iconv wrappers.
  206. -- converter : conversion descriptor from g_iconv_open()
  207. -- inbuf : bytes to convert
  208. -- inbytes_left : inout parameter, bytes remaining to convert in inbuf
  209. -- outbuf : converted output bytes
  210. -- outbytes_left : inout parameter, bytes available to fill in outbuf
  211. -- Returns : count of non-reversible conversions, or -1 on error
  212. -- ---------------------------------------------------------------------------------
  213. -- g_iconv_close ()
  214. -- gint g_iconv_close (GIConv converter);
  215. -- Same as the standard UNIX routine iconv_close(), but may be implemented via
  216. -- libiconv on UNIX flavors that lack a native implementation. Should be called to
  217. -- clean up the conversion descriptor from g_iconv_open() when you are done
  218. -- converting things.
  219. -- GLib provides g_convert() and g_locale_to_utf8() which are likely more convenient
  220. -- than the raw iconv wrappers.
  221. -- converter : a conversion descriptor from g_iconv_open()
  222. -- Returns : -1 on error, 0 on success
  223. -- ---------------------------------------------------------------------------------
  224. g_locale_to_utf8 (opsysstring: POINTER; opsysstring_len: INTEGER; bytes_read, bytes_written, error: POINTER): POINTER is
  225. -- Converts a string which is in the encoding used for strings by the C runtime
  226. -- (usually the same as that used by the operating system) in the current locale
  227. -- into a UTF-8 string.
  228. -- opsysstring : a string in the encoding of the current locale. On Windows this
  229. -- means the system codepage.
  230. -- opsysstring_len : the length of the string, or -1 if the string is
  231. -- nul-terminated^[1].
  232. -- bytes_read : location to store the number of bytes in the input string that
  233. -- were successfully converted, or NULL. Even if the conversion was
  234. -- successful, this may be less than len if there were partial
  235. -- characters at the end of the input. If the error
  236. -- G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will
  237. -- the byte offset after the last valid input sequence.
  238. -- bytes_written : the number of bytes stored in the output buffer (not including
  239. -- the terminating nul).
  240. -- error : location to store the error occuring, or NULL to ignore errors.
  241. -- Any of the errors in GConvertError may occur.
  242. -- Returns : The converted string, or NULL on an error.
  243. external "C use <glib.h>"
  244. end
  245. -- ---------------------------------------------------------------------------------
  246. -- g_filename_to_utf8 ()
  247. -- gchar* g_filename_to_utf8 (const gchar *opsysstring,
  248. -- gssize len,
  249. -- gsize *bytes_read,
  250. -- gsize *bytes_written,
  251. -- GError **error);
  252. -- Converts a string which is in the encoding used by GLib for filenames into a
  253. -- UTF-8 string. Note that on Windows GLib uses UTF-8 for filenames.
  254. -- opsysstring : a string in the encoding for filenames
  255. -- len : the length of the string, or -1 if the string is
  256. -- nul-terminated^[1].
  257. -- bytes_read : location to store the number of bytes in the input string that
  258. -- were successfully converted, or NULL. Even if the conversion was
  259. -- successful, this may be less than len if there were partial
  260. -- characters at the end of the input. If the error
  261. -- G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will
  262. -- the byte offset after the last valid input sequence.
  263. -- bytes_written : the number of bytes stored in the output buffer (not including
  264. -- the terminating nul).
  265. -- error : location to store the error occuring, or NULL to ignore errors.
  266. -- Any of the errors in GConvertError may occur.
  267. -- Returns : The converted string, or NULL on an error.
  268. -- ---------------------------------------------------------------------------------
  269. g_filename_from_utf8 (an_utf8_string: POINTER; a_len: INTEGER;
  270. a_bytes_read, a_bytes_written, an_error: POINTER): POINTER is
  271. -- Converts a string from UTF-8 to the encoding GLib uses for filenames. Note that
  272. -- on Windows GLib uses UTF-8 for filenames.
  273. -- utf8string : a UTF-8 encoded string.
  274. -- len : the length of the string, or -1 if the string is nul-terminated.
  275. -- bytes_read : location to store the number of bytes in the input string that
  276. -- were successfully converted, or NULL. Even if the conversion was
  277. -- successful, this may be less than len if there were partial
  278. -- characters at the end of the input. If the error
  279. -- G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will
  280. -- the byte offset after the last valid input sequence.
  281. -- bytes_written : the number of bytes stored in the output buffer (not including
  282. -- the terminating nul).
  283. -- error : location to store the error occuring, or NULL to ignore errors.
  284. -- Any of the errors in GConvertError may occur.
  285. -- Returns : The converted string, or NULL on an error.
  286. external "C use <glib.h>"
  287. end
  288. -- ---------------------------------------------------------------------------------
  289. -- g_filename_from_uri ()
  290. -- gchar* g_filename_from_uri (const gchar *uri,
  291. -- gchar **hostname,
  292. -- GError **error);
  293. -- Converts an escaped ASCII-encoded URI to a local filename in the encoding used
  294. -- for filenames.
  295. -- uri : a uri describing a filename (escaped, encoded in ASCII).
  296. -- hostname : Location to store hostname for the URI, or NULL. If there is no
  297. -- hostname in the URI, NULL will be stored in this location.
  298. -- error : location to store the error occuring, or NULL to ignore errors. Any of
  299. -- the errors in GConvertError may occur.
  300. -- Returns : a newly-allocated string holding the resulting filename, or NULL on an
  301. -- error.
  302. -- ---------------------------------------------------------------------------------
  303. -- g_filename_to_uri ()
  304. -- gchar* g_filename_to_uri (const gchar *filename,
  305. -- const gchar *hostname,
  306. -- GError **error);
  307. -- Converts an absolute filename to an escaped ASCII-encoded URI, with the path
  308. -- component following Section 3.3. of RFC 2396.
  309. -- filename : an absolute filename specified in the GLib file name encoding, which
  310. -- is the on-disk file name bytes on Unix, and UTF-8 on Windows
  311. -- hostname : A UTF-8 encoded hostname, or NULL for none.
  312. -- error : location to store the error occuring, or NULL to ignore errors. Any of
  313. -- the errors in GConvertError may occur.
  314. -- Returns : a newly-allocated string holding the resulting URI, or NULL on an
  315. -- error.
  316. -- ---------------------------------------------------------------------------------
  317. -- g_get_filename_charsets ()
  318. -- gboolean g_get_filename_charsets (G_CONST_RETURN gchar ***charsets);
  319. -- Determines the preferred character sets used for filenames. The first character
  320. -- set from the charsets is the filename encoding, the subsequent character sets are
  321. -- used when trying to generate a displayable representation of a filename, see
  322. -- g_filename_display_name().
  323. -- On Unix, the character sets are determined by consulting the environment
  324. -- variables G_FILENAME_ENCODING and G_BROKEN_FILENAMES. On Windows, the character
  325. -- set used in the GLib API is always UTF-8 and said environment variables have no
  326. -- effect.
  327. -- G_FILENAME_ENCODING may be set to a comma-separated list of character set names.
  328. -- The special token "locale" is taken to mean the character set for the current
  329. -- locale. If G_FILENAME_ENCODING is not set, but G_BROKEN_FILENAMES is, the
  330. -- character set of the current locale is taken as the filename encoding. If neither
  331. -- environment variable is set, UTF-8 is taken as the filename encoding, but the
  332. -- character set of the current locale is also put in the list of encodings.
  333. -- The returned charsets belong to GLib and must not be freed.
  334. -- Note that on Unix, regardless of the locale character set or G_FILENAME_ENCODING
  335. -- value, the actual file names present on a system might be in any random encoding
  336. -- or just gibberish.
  337. -- charsets : return location for the NULL-terminated list of encoding names
  338. -- Returns : TRUE if the filename encoding is UTF-8.
  339. -- Since 2.6
  340. -- ---------------------------------------------------------------------------------
  341. -- g_filename_display_name ()
  342. -- gchar* g_filename_display_name (const gchar *filename);
  343. -- Converts a filename into a valid UTF-8 string. The conversion is not necessarily
  344. -- reversible, so you should keep the original around and use the return value of
  345. -- this function only for display purposes. Unlike g_filename_to_utf8(), the result
  346. -- is guaranteed to be non-NULL even if the filename actually isn't in the GLib file
  347. -- name encoding.
  348. -- If GLib can not make sense of the encoding of filename, as a last resort it
  349. -- replaces unknown characters with U+FFFD, the Unicode replacement character. You
  350. -- can search the result for the UTF-8 encoding of this character (which is
  351. -- "\357\277\275" in octal notation) to find out if filename was in an invalid
  352. -- encoding.
  353. -- If you know the whole pathname of the file you should use
  354. -- g_filename_display_basename(), since that allows location-based translation of
  355. -- filenames.
  356. -- filename : a pathname hopefully in the GLib file name encoding
  357. -- Returns : a newly allocated string containing a rendition of the filename in
  358. -- valid UTF-8
  359. -- Since 2.6
  360. -- ---------------------------------------------------------------------------------
  361. -- g_filename_display_basename ()
  362. -- gchar* g_filename_display_basename (const gchar *filename);
  363. -- Returns the display basename for the particular filename, guaranteed to be valid
  364. -- UTF-8. The display name might not be identical to the filename, for instance
  365. -- there might be problems converting it to UTF-8, and some files can be translated
  366. -- in the display.
  367. -- If GLib can not make sense of the encoding of filename, as a last resort it
  368. -- replaces unknown characters with U+FFFD, the Unicode replacement character. You
  369. -- can search the result for the UTF-8 encoding of this character (which is
  370. -- "\357\277\275" in octal notation) to find out if filename was in an invalid
  371. -- encoding.
  372. -- You must pass the whole absolute pathname to this functions so that translation
  373. -- of well known locations can be done.
  374. -- This function is preferred over g_filename_display_name() if you know the whole
  375. -- path, as it allows translation.
  376. -- filename : an absolute pathname in the GLib file name encoding
  377. -- Returns : a newly allocated string containing a rendition of the basename of the
  378. -- filename in valid UTF-8
  379. -- Since 2.6
  380. -- ---------------------------------------------------------------------------------
  381. -- g_uri_list_extract_uris ()
  382. -- gchar** g_uri_list_extract_uris (const gchar *uri_list);
  383. -- Splits an URI list conforming to the text/uri-list mime type defined in RFC 2483
  384. -- into individual URIs, discarding any comments. The URIs are not validated.
  385. -- uri_list : an URI list
  386. -- Returns : a newly allocated NULL-terminated list of strings holding the
  387. -- individual URIs. The array should be freed with g_strfreev().
  388. -- Since 2.6
  389. -- ---------------------------------------------------------------------------------
  390. g_locale_from_utf8 (a_string: POINTER; a_string_length: INTEGER; bytes_read, bytes_written, error: POINTER): POINTER is
  391. -- Converts a string from UTF-8 to the encoding used for strings by the C runtime
  392. -- (usually the same as that used by the operating system) in the current locale.
  393. -- utf8string : a UTF-8 encoded string
  394. -- len : the length of the string, or -1 if the string is
  395. -- nul-terminated^[1].
  396. -- bytes_read : location to store the number of bytes in the input string that
  397. -- were successfully converted, or NULL. Even if the conversion was
  398. -- successful, this may be less than len if there were partial
  399. -- characters at the end of the input. If the error
  400. -- G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will
  401. -- the byte offset after the last valid input sequence.
  402. -- bytes_written : the number of bytes stored in the output buffer (not including
  403. -- the terminating nul).
  404. -- error : location to store the error occuring, or NULL to ignore errors.
  405. -- Any of the errors in GConvertError may occur.
  406. -- Returns : The converted string, or NULL on an error.
  407. external "C use <glib.h>"
  408. end
  409. -- ---------------------------------------------------------------------------------
  410. -- enum GConvertError
  411. -- typedef enum
  412. -- {
  413. -- G_CONVERT_ERROR_NO_CONVERSION,
  414. -- G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
  415. -- G_CONVERT_ERROR_FAILED,
  416. -- G_CONVERT_ERROR_PARTIAL_INPUT,
  417. -- G_CONVERT_ERROR_BAD_URI,
  418. -- G_CONVERT_ERROR_NOT_ABSOLUTE_PATH
  419. -- } GConvertError;
  420. -- Error codes returned by character set conversion routines.
  421. -- G_CONVERT_ERROR_NO_CONVERSION Conversion between the requested character sets
  422. -- is not supported.
  423. -- G_CONVERT_ERROR_ILLEGAL_SEQUENCE Invalid byte sequence in conversion input.
  424. -- G_CONVERT_ERROR_FAILED Conversion failed for some reason.
  425. -- G_CONVERT_ERROR_PARTIAL_INPUT Partial character sequence at end of input.
  426. -- G_CONVERT_ERROR_BAD_URI URI is invalid.
  427. -- G_CONVERT_ERROR_NOT_ABSOLUTE_PATH Pathname is not an absolute path.
  428. -- ---------------------------------------------------------------------------------
  429. -- g_get_charset ()
  430. -- gboolean g_get_charset (G_CONST_RETURN char **charset);
  431. -- Obtains the character set for the current locale; you might use this character
  432. -- set as an argument to g_convert(), to convert from the current locale's encoding
  433. -- to some other encoding. (Frequently g_locale_to_utf8() and g_locale_from_utf8()
  434. -- are nice shortcuts, though.)
  435. -- The return value is TRUE if the locale's encoding is UTF-8, in that case you can
  436. -- perhaps avoid calling g_convert().
  437. -- The string returned in charset is not allocated, and should not be freed.
  438. -- charset : return location for character set name
  439. -- Returns : TRUE if the returned charset is UTF-8
  440. -- --------------
  441. -- ^[1] Note that some encodings may allow nul bytes to occur inside strings. In
  442. -- that case, using -1 for the len parameter is unsafe.
  443. -- ^[2] Despite the fact that byes_read can return information about partial
  444. -- characters, the g_convert_... functions are not generally suitable for streaming.
  445. -- If the underlying converter being used maintains internal state, then this won't
  446. -- be preserved across successive calls to g_convert(), g_convert_with_iconv() or
  447. -- g_convert_with_fallback(). (An example of this is the GNU C converter for CP1255
  448. -- which does not emit a base character until it knows that the next character is
  449. -- not a mark that could combine with the base character.)
  450. end -- class GLIB_CHARACTER_SET_CONVERSION