1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 functions operating on Unicode characters and UTF-8 strings.
7 <!-- ##### SECTION Long_Description ##### -->
9 This section describes a number of functions for dealing with
10 Unicode characters and strings. There are analogues of the
11 traditional <filename>ctype.h</filename> character classification
12 and case conversion functions, UTF-8 analogues of some string utility
13 functions, functions to perform normalization, case conversion and
14 collation on UTF-8 strings and finally functions to convert between
15 the UTF-8, UTF-16 and UCS-4 encodings of Unicode.
18 <!-- ##### SECTION See_Also ##### -->
23 <term>g_locale_to_utf8(), g_locale_from_utf8()</term>
25 Convenience functions for converting between UTF-8 and the locale encoding.
32 <!-- ##### TYPEDEF gunichar ##### -->
34 A type which can hold any UCS-4 character code.
38 <!-- ##### TYPEDEF gunichar2 ##### -->
40 A type which can hold any UTF-16 character code.
44 <!-- ##### FUNCTION g_get_charset ##### -->
50 <!-- # Unused Parameters # -->
54 <!-- ##### FUNCTION g_unichar_validate ##### -->
63 <!-- ##### FUNCTION g_unichar_isalnum ##### -->
72 <!-- ##### FUNCTION g_unichar_isalpha ##### -->
81 <!-- ##### FUNCTION g_unichar_iscntrl ##### -->
90 <!-- ##### FUNCTION g_unichar_isdigit ##### -->
99 <!-- ##### FUNCTION g_unichar_isgraph ##### -->
108 <!-- ##### FUNCTION g_unichar_islower ##### -->
117 <!-- ##### FUNCTION g_unichar_isprint ##### -->
126 <!-- ##### FUNCTION g_unichar_ispunct ##### -->
135 <!-- ##### FUNCTION g_unichar_isspace ##### -->
144 <!-- ##### FUNCTION g_unichar_isupper ##### -->
153 <!-- ##### FUNCTION g_unichar_isxdigit ##### -->
162 <!-- ##### FUNCTION g_unichar_istitle ##### -->
171 <!-- ##### FUNCTION g_unichar_isdefined ##### -->
180 <!-- ##### FUNCTION g_unichar_iswide ##### -->
189 <!-- ##### FUNCTION g_unichar_toupper ##### -->
198 <!-- ##### FUNCTION g_unichar_tolower ##### -->
207 <!-- ##### FUNCTION g_unichar_totitle ##### -->
216 <!-- ##### FUNCTION g_unichar_digit_value ##### -->
225 <!-- ##### FUNCTION g_unichar_xdigit_value ##### -->
234 <!-- ##### ENUM GUnicodeType ##### -->
236 These are the possible character classifications.
237 See <ulink url="http://www.unicode.org/Public/UNIDATA/UnicodeData.html"
238 >http://www.unicode.org/Public/UNIDATA/UnicodeData.html</ulink>.
243 @G_UNICODE_UNASSIGNED:
244 @G_UNICODE_PRIVATE_USE:
245 @G_UNICODE_SURROGATE:
246 @G_UNICODE_LOWERCASE_LETTER:
247 @G_UNICODE_MODIFIER_LETTER:
248 @G_UNICODE_OTHER_LETTER:
249 @G_UNICODE_TITLECASE_LETTER:
250 @G_UNICODE_UPPERCASE_LETTER:
251 @G_UNICODE_COMBINING_MARK:
252 @G_UNICODE_ENCLOSING_MARK:
253 @G_UNICODE_NON_SPACING_MARK:
254 @G_UNICODE_DECIMAL_NUMBER:
255 @G_UNICODE_LETTER_NUMBER:
256 @G_UNICODE_OTHER_NUMBER:
257 @G_UNICODE_CONNECT_PUNCTUATION:
258 @G_UNICODE_DASH_PUNCTUATION:
259 @G_UNICODE_CLOSE_PUNCTUATION:
260 @G_UNICODE_FINAL_PUNCTUATION:
261 @G_UNICODE_INITIAL_PUNCTUATION:
262 @G_UNICODE_OTHER_PUNCTUATION:
263 @G_UNICODE_OPEN_PUNCTUATION:
264 @G_UNICODE_CURRENCY_SYMBOL:
265 @G_UNICODE_MODIFIER_SYMBOL:
266 @G_UNICODE_MATH_SYMBOL:
267 @G_UNICODE_OTHER_SYMBOL:
268 @G_UNICODE_LINE_SEPARATOR:
269 @G_UNICODE_PARAGRAPH_SEPARATOR:
270 @G_UNICODE_SPACE_SEPARATOR:
272 <!-- ##### FUNCTION g_unichar_type ##### -->
281 <!-- ##### ENUM GUnicodeBreakType ##### -->
283 These are the possible line break classifications.
284 See <ulink url="http://www.unicode.org/unicode/reports/tr14/"
285 >http://www.unicode.org/unicode/reports/tr14/</ulink>.
288 @G_UNICODE_BREAK_MANDATORY:
289 @G_UNICODE_BREAK_CARRIAGE_RETURN:
290 @G_UNICODE_BREAK_LINE_FEED:
291 @G_UNICODE_BREAK_COMBINING_MARK:
292 @G_UNICODE_BREAK_SURROGATE:
293 @G_UNICODE_BREAK_ZERO_WIDTH_SPACE:
294 @G_UNICODE_BREAK_INSEPARABLE:
295 @G_UNICODE_BREAK_NON_BREAKING_GLUE:
296 @G_UNICODE_BREAK_CONTINGENT:
297 @G_UNICODE_BREAK_SPACE:
298 @G_UNICODE_BREAK_AFTER:
299 @G_UNICODE_BREAK_BEFORE:
300 @G_UNICODE_BREAK_BEFORE_AND_AFTER:
301 @G_UNICODE_BREAK_HYPHEN:
302 @G_UNICODE_BREAK_NON_STARTER:
303 @G_UNICODE_BREAK_OPEN_PUNCTUATION:
304 @G_UNICODE_BREAK_CLOSE_PUNCTUATION:
305 @G_UNICODE_BREAK_QUOTATION:
306 @G_UNICODE_BREAK_EXCLAMATION:
307 @G_UNICODE_BREAK_IDEOGRAPHIC:
308 @G_UNICODE_BREAK_NUMERIC:
309 @G_UNICODE_BREAK_INFIX_SEPARATOR:
310 @G_UNICODE_BREAK_SYMBOL:
311 @G_UNICODE_BREAK_ALPHABETIC:
312 @G_UNICODE_BREAK_PREFIX:
313 @G_UNICODE_BREAK_POSTFIX:
314 @G_UNICODE_BREAK_COMPLEX_CONTEXT:
315 @G_UNICODE_BREAK_AMBIGUOUS:
316 @G_UNICODE_BREAK_UNKNOWN:
318 <!-- ##### FUNCTION g_unichar_break_type ##### -->
327 <!-- ##### FUNCTION g_unicode_canonical_ordering ##### -->
336 <!-- ##### FUNCTION g_unicode_canonical_decomposition ##### -->
346 <!-- ##### MACRO g_utf8_next_char ##### -->
348 Skips to the next character in a UTF-8 string. The string must be
349 valid; this macro is as fast as possible, and has no error-checking.
350 You would use this macro to iterate over a string character by
351 character. The macro returns the start of the next UTF-8 character.
352 Before using this macro, use g_utf8_validate() to validate strings
353 that may contain invalid UTF-8.
356 @p: Pointer to the start of a valid UTF-8 character.
359 <!-- ##### FUNCTION g_utf8_get_char ##### -->
368 <!-- ##### FUNCTION g_utf8_get_char_validated ##### -->
378 <!-- ##### FUNCTION g_utf8_offset_to_pointer ##### -->
388 <!-- ##### FUNCTION g_utf8_pointer_to_offset ##### -->
398 <!-- ##### FUNCTION g_utf8_prev_char ##### -->
407 <!-- ##### FUNCTION g_utf8_find_next_char ##### -->
415 <!-- # Unused Parameters # -->
419 <!-- ##### FUNCTION g_utf8_find_prev_char ##### -->
429 <!-- ##### FUNCTION g_utf8_strlen ##### -->
439 <!-- ##### FUNCTION g_utf8_strncpy ##### -->
450 <!-- ##### FUNCTION g_utf8_strchr ##### -->
459 <!-- # Unused Parameters # -->
463 <!-- ##### FUNCTION g_utf8_strrchr ##### -->
472 <!-- # Unused Parameters # -->
476 <!-- ##### FUNCTION g_utf8_validate ##### -->
487 <!-- ##### FUNCTION g_utf8_strup ##### -->
497 <!-- ##### FUNCTION g_utf8_strdown ##### -->
507 <!-- ##### FUNCTION g_utf8_casefold ##### -->
517 <!-- ##### FUNCTION g_utf8_normalize ##### -->
528 <!-- ##### ENUM GNormalizeMode ##### -->
530 Defines how a Unicode string is transformed in a canonical
531 form, standardizing such issues as whether a character with an accent is
532 represented as a base character and combining accent or as a single precomposed
533 character. Unicode strings should generally be normalized before comparing them.
536 @G_NORMALIZE_DEFAULT: standardize differences that do not affect the
537 text content, such as the above-mentioned accent representation.
538 @G_NORMALIZE_NFD: another name for %G_NORMALIZE_DEFAULT.
539 @G_NORMALIZE_DEFAULT_COMPOSE: like %G_NORMALIZE_DEFAULT, but with composed
540 forms rather than a maximally decomposed form.
541 @G_NORMALIZE_NFC: another name for %G_NORMALIZE_DEFAULT_COMPOSE.
542 @G_NORMALIZE_ALL: beyond %G_NORMALIZE_DEFAULT also standardize the
543 "compatibility" characters in Unicode, such as SUPERSCRIPT THREE to the
544 standard forms (in this case DIGIT THREE). Formatting information may be
545 lost but for most text operations such characters should be considered the
547 @G_NORMALIZE_NFKD: another name for %G_NORMALIZE_ALL.
548 @G_NORMALIZE_ALL_COMPOSE: like %G_NORMALIZE_ALL, but with composed
549 forms rather than a maximally decomposed form.
550 @G_NORMALIZE_NFKC: another name for %G_NORMALIZE_ALL_COMPOSE.
552 <!-- ##### FUNCTION g_utf8_collate ##### -->
562 <!-- ##### FUNCTION g_utf8_collate_key ##### -->
572 <!-- ##### FUNCTION g_utf8_to_utf16 ##### -->
585 <!-- ##### FUNCTION g_utf8_to_ucs4 ##### -->
598 <!-- ##### FUNCTION g_utf8_to_ucs4_fast ##### -->
609 <!-- ##### FUNCTION g_utf16_to_ucs4 ##### -->
622 <!-- ##### FUNCTION g_utf16_to_utf8 ##### -->
635 <!-- ##### FUNCTION g_ucs4_to_utf16 ##### -->
648 <!-- ##### FUNCTION g_ucs4_to_utf8 ##### -->
661 <!-- ##### FUNCTION g_unichar_to_utf8 ##### -->