GNU Libidn API Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
#define STRINGPREP_VERSION #define STRINGPREP_MAX_MAP_CHARS int stringprep (char *in, int maxlen, int flags, Stringprep_profile *profile); const char* stringprep_check_version (const char *req_version); int stringprep_unichar_to_utf8 (unsigned long c, char *outbuf); unsigned long stringprep_utf8_to_unichar (const char *p); unsigned long* stringprep_utf8_to_ucs4 (const char *str, int len, int *items_written); char* stringprep_ucs4_to_utf8 (unsigned long *str, int len, int *items_read, int *items_written); char* stringprep_utf8_nfkc_normalize (const char *str, int len); unsigned long* stringprep_ucs4_nfkc_normalize (unsigned long *str, int len); const char* stringprep_locale_charset (void); char* stringprep_convert (const char *str, const char *to_codeset, const char *from_codeset); char* stringprep_locale_to_utf8 (const char *str); char* stringprep_utf8_to_locale (const char *str); |
Stringprep describes a framework for preparing Unicode text strings in order to increase the likelihood that string input and string comparison work in ways that make sense for typical users throughout the world. The stringprep protocol is useful for protocol identifier values, company and personal names, internationalized domain names, and other text strings.
#define STRINGPREP_VERSION "0.1.2" |
String defined via CPP denoting the header file version number. Used together with stringprep_check_version() to verify header file and run-time library consistency.
int stringprep (char *in, int maxlen, int flags, Stringprep_profile *profile); |
Prepare the input UTF-8 string according to the stringprep profile. Normally application programmers use stringprep profile macros such as stringprep_nameprep(), stringprep_kerberos5() etc instead of calling this function directly.
const char* stringprep_check_version (const char *req_version); |
Check that the the version of the library is at minimum the requested one and return the version string; return NULL if the condition is not satisfied. If a NULL is passed to this function, no check is done, but the version string is simply returned.
See STRINGPREP_VERSION for a suitable req_version string.
int stringprep_unichar_to_utf8 (unsigned long c, char *outbuf); |
Converts a single character to UTF-8.
unsigned long stringprep_utf8_to_unichar (const char *p); |
Converts a sequence of bytes encoded as UTF-8 to a Unicode character. If p does not point to a valid UTF-8 encoded character, results are undefined.
unsigned long* stringprep_utf8_to_ucs4 (const char *str, int len, int *items_written); |
Convert a string from UTF-8 to a 32-bit fixed width representation as UCS-4, assuming valid UTF-8 input. This function does no error checking on the input.
char* stringprep_ucs4_to_utf8 (unsigned long *str, int len, int *items_read, int *items_written); |
Convert a string from a 32-bit fixed width representation as UCS-4. to UTF-8. The result will be terminated with a 0 byte.
str : | a UCS-4 encoded string |
len : | the maximum length of str to use. If len < 0, then the string is terminated with a 0 character. |
items_read : | location to store number of characters read read, or NULL. |
items_written : | location to store number of bytes written or NULL. The value here stored does not include the trailing 0 byte. |
Returns : | a pointer to a newly allocated UTF-8 string. This value must be freed with g_free(). If an error occurs, NULL will be returned and error set. |
char* stringprep_utf8_nfkc_normalize (const char *str, int len); |
Converts a string into canonical form, standardizing such issues as whether a character with an accent is represented as a base character and combining accent or as a single precomposed character. You should generally call g_utf8_normalize() before comparing two Unicode strings.
The normalization mode is NFKC (ALL COMPOSE). It standardizes differences that do not affect the text content, such as the above-mentioned accent representation. It standardizes the "compatibility" characters in Unicode, such as SUPERSCRIPT THREE to the standard forms (in this case DIGIT THREE). Formatting information may be lost but for most text operations such characters should be considered the same. It returns a result with composed forms rather than a maximally decomposed form.
unsigned long* stringprep_ucs4_nfkc_normalize (unsigned long *str, int len); |
Converts UCS4 string into UTF-8 and runs stringprep_utf4_nfkc_normalize().
char* stringprep_convert (const char *str, const char *to_codeset, const char *from_codeset); |
Convert the string from one character set to another using the system's iconv() function.
char* stringprep_locale_to_utf8 (const char *str); |
Convert string encoded in the locale's character set into UTF-8 by using stringprep_convert().
char* stringprep_utf8_to_locale (const char *str); |
Convert string encoded in UTF-8 into the locale's character set by using stringprep_convert().