Back to index

glibc  2.9
Classes | Defines | Typedefs | Enumerations | Functions | Variables
stringprep.h File Reference
#include <stddef.h>
#include <unistd.h>
#include <stdint.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Stringprep_table_element
struct  Stringprep_table
struct  Stringprep_profiles

Defines

#define STRINGPREP_VERSION   "0.4.3"
#define STRINGPREP_MAX_MAP_CHARS   4
#define stringprep_nameprep(in, maxlen)   stringprep(in, maxlen, 0, stringprep_nameprep)
#define stringprep_nameprep_no_unassigned(in, maxlen)   stringprep(in, maxlen, STRINGPREP_NO_UNASSIGNED, stringprep_nameprep)
#define stringprep_plain(in, maxlen)   stringprep(in, maxlen, 0, stringprep_plain)
#define stringprep_kerberos5(in, maxlen)   stringprep(in, maxlen, 0, stringprep_kerberos5)
#define stringprep_xmpp_nodeprep(in, maxlen)   stringprep(in, maxlen, 0, stringprep_xmpp_nodeprep)
#define stringprep_xmpp_resourceprep(in, maxlen)   stringprep(in, maxlen, 0, stringprep_xmpp_resourceprep)
#define stringprep_iscsi(in, maxlen)   stringprep(in, maxlen, 0, stringprep_iscsi)

Typedefs

typedef struct Stringprep_table_element
typedef struct Stringprep_table
typedef struct Stringprep_profiles

Enumerations

enum  Stringprep_rc {
  STRINGPREP_OK = 0, STRINGPREP_CONTAINS_UNASSIGNED = 1, STRINGPREP_CONTAINS_PROHIBITED = 2, STRINGPREP_BIDI_BOTH_L_AND_RAL = 3,
  STRINGPREP_BIDI_LEADTRAIL_NOT_RAL = 4, STRINGPREP_BIDI_CONTAINS_PROHIBITED = 5, STRINGPREP_TOO_SMALL_BUFFER = 100, STRINGPREP_PROFILE_ERROR = 101,
  STRINGPREP_FLAG_ERROR = 102, STRINGPREP_UNKNOWN_PROFILE = 103, STRINGPREP_NFKC_FAILED = 200, STRINGPREP_MALLOC_ERROR = 201
}
enum  Stringprep_profile_flags { STRINGPREP_NO_NFKC = 1, STRINGPREP_NO_BIDI = 2, STRINGPREP_NO_UNASSIGNED = 4 }
enum  Stringprep_profile_steps {
  STRINGPREP_NFKC = 1, STRINGPREP_BIDI = 2, STRINGPREP_MAP_TABLE = 3, STRINGPREP_UNASSIGNED_TABLE = 4,
  STRINGPREP_PROHIBIT_TABLE = 5, STRINGPREP_BIDI_PROHIBIT_TABLE = 6, STRINGPREP_BIDI_RAL_TABLE = 7, STRINGPREP_BIDI_L_TABLE = 8
}

Functions

int stringprep_4i (uint32_t *ucs4, size_t *len, size_t maxucs4len, Stringprep_profile_flags flags, const Stringprep_profile *profile)
 stringprep_4i: : input/output array with string to prepare.
int stringprep_4zi (uint32_t *ucs4, size_t maxucs4len, Stringprep_profile_flags flags, const Stringprep_profile *profile)
 stringprep_4zi: : input/output array with zero terminated string to prepare.
int stringprep (char *in, size_t maxlen, Stringprep_profile_flags flags, const Stringprep_profile *profile)
 stringprep: : input/ouput array with string to prepare.
int stringprep_profile (const char *in, char **out, const char *profile, Stringprep_profile_flags flags)
 stringprep_profile: : input array with UTF-8 string to prepare.
const char * stringprep_check_version (const char *req_version)
int stringprep_unichar_to_utf8 (uint32_t c, char *outbuf)
 stringprep_unichar_to_utf8: : a ISO10646 character code : output buffer, must have at least 6 bytes of space.
uint32_t stringprep_utf8_to_unichar (const char *p)
 stringprep_utf8_to_unichar: : a pointer to Unicode character encoded as UTF-8
uint32_tstringprep_utf8_to_ucs4 (const char *str, ssize_t len, size_t *items_written)
 stringprep_utf8_to_ucs4: : a UTF-8 encoded string : the maximum length of to use.
char * stringprep_ucs4_to_utf8 (const uint32_t *str, ssize_t len, size_t *items_read, size_t *items_written)
 stringprep_ucs4_to_utf8: : a UCS-4 encoded string : the maximum length of to use.
char * stringprep_utf8_nfkc_normalize (const char *str, ssize_t len)
 stringprep_utf8_nfkc_normalize: : a UTF-8 encoded string.
uint32_tstringprep_ucs4_nfkc_normalize (uint32_t *str, ssize_t len)
 stringprep_ucs4_nfkc_normalize: : a Unicode string.
const char * stringprep_locale_charset (void)
 stringprep_locale_charset - return charset used in current locale
char * stringprep_convert (const char *str, const char *to_codeset, const char *from_codeset)
 stringprep_convert - encode string using new character set : input zero-terminated string.
char * stringprep_locale_to_utf8 (const char *str)
 stringprep_locale_to_utf8 - convert locale encoded string to UTF-8 : input zero terminated string.
char * stringprep_utf8_to_locale (const char *str)
 stringprep_utf8_to_locale - encode UTF-8 string to locale encoding : input zero terminated string.

Variables

const Stringprep_profiles stringprep_profiles []
const Stringprep_table_element stringprep_rfc3454_A_1 []
const Stringprep_table_element stringprep_rfc3454_B_1 []
const Stringprep_table_element stringprep_rfc3454_B_2 []
const Stringprep_table_element stringprep_rfc3454_B_3 []
const Stringprep_table_element stringprep_rfc3454_C_1_1 []
const Stringprep_table_element stringprep_rfc3454_C_1_2 []
const Stringprep_table_element stringprep_rfc3454_C_2_1 []
const Stringprep_table_element stringprep_rfc3454_C_2_2 []
const Stringprep_table_element stringprep_rfc3454_C_3 []
const Stringprep_table_element stringprep_rfc3454_C_4 []
const Stringprep_table_element stringprep_rfc3454_C_5 []
const Stringprep_table_element stringprep_rfc3454_C_6 []
const Stringprep_table_element stringprep_rfc3454_C_7 []
const Stringprep_table_element stringprep_rfc3454_C_8 []
const Stringprep_table_element stringprep_rfc3454_C_9 []
const Stringprep_table_element stringprep_rfc3454_D_1 []
const Stringprep_table_element stringprep_rfc3454_D_2 []
const Stringprep_profile stringprep_nameprep []
const Stringprep_profile stringprep_saslprep []
const Stringprep_profile stringprep_plain []
const Stringprep_profile stringprep_trace []
const Stringprep_profile stringprep_kerberos5 []
const Stringprep_profile stringprep_xmpp_nodeprep []
const Stringprep_profile stringprep_xmpp_resourceprep []
const Stringprep_table_element stringprep_xmpp_nodeprep_prohibit []
const Stringprep_profile stringprep_iscsi []

Class Documentation

struct Stringprep_table_element

Definition at line 79 of file stringprep.h.

Class Members
uint32_t end
uint32_t map
uint32_t start
struct Stringprep_table

Definition at line 87 of file stringprep.h.

Collaboration diagram for Stringprep_table:
Class Members
Stringprep_profile_flags flags
Stringprep_profile_steps operation
const Stringprep_table_element * table
struct Stringprep_profiles

Definition at line 95 of file stringprep.h.

Class Members
const char * name
const Stringprep_profile * tables

Define Documentation

#define stringprep_iscsi (   in,
  maxlen 
)    stringprep(in, maxlen, 0, stringprep_iscsi)

Definition at line 164 of file stringprep.h.

#define stringprep_kerberos5 (   in,
  maxlen 
)    stringprep(in, maxlen, 0, stringprep_kerberos5)

Definition at line 146 of file stringprep.h.

#define STRINGPREP_MAX_MAP_CHARS   4

Definition at line 77 of file stringprep.h.

#define stringprep_nameprep (   in,
  maxlen 
)    stringprep(in, maxlen, 0, stringprep_nameprep)

Definition at line 127 of file stringprep.h.

Definition at line 130 of file stringprep.h.

#define stringprep_plain (   in,
  maxlen 
)    stringprep(in, maxlen, 0, stringprep_plain)

Definition at line 139 of file stringprep.h.

#define STRINGPREP_VERSION   "0.4.3"

Definition at line 34 of file stringprep.h.

#define stringprep_xmpp_nodeprep (   in,
  maxlen 
)    stringprep(in, maxlen, 0, stringprep_xmpp_nodeprep)

Definition at line 155 of file stringprep.h.

#define stringprep_xmpp_resourceprep (   in,
  maxlen 
)    stringprep(in, maxlen, 0, stringprep_xmpp_resourceprep)

Definition at line 157 of file stringprep.h.


Typedef Documentation

typedef struct Stringprep_profiles

Definition at line 100 of file stringprep.h.

typedef struct Stringprep_table

Definition at line 93 of file stringprep.h.

typedef struct Stringprep_table_element

Definition at line 85 of file stringprep.h.


Enumeration Type Documentation

Enumerator:
STRINGPREP_NO_NFKC 
STRINGPREP_NO_BIDI 
STRINGPREP_NO_UNASSIGNED 

Definition at line 57 of file stringprep.h.

Enumerator:
STRINGPREP_NFKC 
STRINGPREP_BIDI 
STRINGPREP_MAP_TABLE 
STRINGPREP_UNASSIGNED_TABLE 
STRINGPREP_PROHIBIT_TABLE 
STRINGPREP_BIDI_PROHIBIT_TABLE 
STRINGPREP_BIDI_RAL_TABLE 
STRINGPREP_BIDI_L_TABLE 

Definition at line 65 of file stringprep.h.

Enumerator:
STRINGPREP_OK 
STRINGPREP_CONTAINS_UNASSIGNED 
STRINGPREP_CONTAINS_PROHIBITED 
STRINGPREP_BIDI_BOTH_L_AND_RAL 
STRINGPREP_BIDI_LEADTRAIL_NOT_RAL 
STRINGPREP_BIDI_CONTAINS_PROHIBITED 
STRINGPREP_TOO_SMALL_BUFFER 
STRINGPREP_PROFILE_ERROR 
STRINGPREP_FLAG_ERROR 
STRINGPREP_UNKNOWN_PROFILE 
STRINGPREP_NFKC_FAILED 
STRINGPREP_MALLOC_ERROR 

Definition at line 37 of file stringprep.h.


Function Documentation

int stringprep ( char *  in,
size_t  maxlen,
Stringprep_profile_flags  flags,
const Stringprep_profile *  profile 
)

stringprep: : input/ouput array with string to prepare.

: maximum length of input/output array. : stringprep profile flags, or 0. : pointer to stringprep profile to use.

Prepare the input zero terminated UTF-8 string according to the stringprep profile, and write back the result to the input string.

Note that you must convert strings entered in the systems locale into UTF-8 before using this function, see stringprep_locale_to_utf8().

Since the stringprep operation can expand the string, indicate how large the buffer holding the string is. This function will not read or write to characters outside that size.

The are one of Stringprep_profile_flags, or 0.

The contain the instructions to perform. Your application can define new profiles, possibly re-using the generic stringprep tables that always will be part of the library, or use one of the currently supported profiles.

Return value: Returns STRINGPREP_OK iff successful, or an error code.

Definition at line 357 of file stringprep.c.

{
  int rc;
  char *utf8 = NULL;
  uint32_t *ucs4 = NULL;
  size_t ucs4len, maxucs4len, adducs4len = 50;

  do
    {
      free (ucs4);
      ucs4 = stringprep_utf8_to_ucs4 (in, -1, &ucs4len);
      maxucs4len = ucs4len + adducs4len;
      uint32_t *newp = realloc (ucs4, maxucs4len * sizeof (uint32_t));
      if (!newp)
       {
         free (ucs4);
         return STRINGPREP_MALLOC_ERROR;
       }
      ucs4 = newp;

      rc = stringprep_4i (ucs4, &ucs4len, maxucs4len, flags, profile);
      adducs4len += 50;
    }
  while (rc == STRINGPREP_TOO_SMALL_BUFFER);
  if (rc != STRINGPREP_OK)
    {
      free (ucs4);
      return rc;
    }

  utf8 = stringprep_ucs4_to_utf8 (ucs4, ucs4len, 0, 0);
  free (ucs4);
  if (!utf8)
    return STRINGPREP_MALLOC_ERROR;

  if (strlen (utf8) >= maxlen)
    {
      free (utf8);
      return STRINGPREP_TOO_SMALL_BUFFER;
    }

  strcpy (in, utf8);        /* flawfinder: ignore */

  free (utf8);

  return STRINGPREP_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int stringprep_4i ( uint32_t ucs4,
size_t len,
size_t  maxucs4len,
Stringprep_profile_flags  flags,
const Stringprep_profile *  profile 
)

stringprep_4i: : input/output array with string to prepare.

: on input, length of input array with Unicode code points, on exit, length of output array with Unicode code points. : maximum length of input/output array. : stringprep profile flags, or 0. : pointer to stringprep profile to use.

Prepare the input UCS-4 string according to the stringprep profile, and write back the result to the input string.

The input is not required to be zero terminated ([] = 0). The output will not be zero terminated unless [] = 0. Instead, see stringprep_4zi() if your input is zero terminated or if you want the output to be.

Since the stringprep operation can expand the string, indicate how large the buffer holding the string is. This function will not read or write to code points outside that size.

The are one of Stringprep_profile_flags, or 0.

The contain the instructions to perform. Your application can define new profiles, possibly re-using the generic stringprep tables that always will be part of the library, or use one of the currently supported profiles.

Return value: Returns STRINGPREP_OK iff successful, or an error code.

Definition at line 137 of file stringprep.c.

{
  size_t i, j;
  ssize_t k;
  size_t ucs4len = *len;
  int rc;

  for (i = 0; profile[i].operation; i++)
    {
      switch (profile[i].operation)
       {
       case STRINGPREP_NFKC:
         {
           uint32_t *q = 0;

           if (UNAPPLICAPLEFLAGS (flags, profile[i].flags))
             break;

           if (flags & STRINGPREP_NO_NFKC && !profile[i].flags)
             /* Profile requires NFKC, but callee asked for no NFKC. */
             return STRINGPREP_FLAG_ERROR;

           q = stringprep_ucs4_nfkc_normalize (ucs4, ucs4len);
           if (!q)
             return STRINGPREP_NFKC_FAILED;

           for (ucs4len = 0; q[ucs4len]; ucs4len++)
             ;

           if (ucs4len >= maxucs4len)
             {
              free (q);
              return STRINGPREP_TOO_SMALL_BUFFER;
             }

           memcpy (ucs4, q, ucs4len * sizeof (ucs4[0]));

           free (q);
         }
         break;

       case STRINGPREP_PROHIBIT_TABLE:
         k = stringprep_find_string_in_table (ucs4, ucs4len,
                                          NULL, profile[i].table);
         if (k != -1)
           return STRINGPREP_CONTAINS_PROHIBITED;
         break;

       case STRINGPREP_UNASSIGNED_TABLE:
         if (UNAPPLICAPLEFLAGS (flags, profile[i].flags))
           break;
         if (flags & STRINGPREP_NO_UNASSIGNED)
           {
             k = stringprep_find_string_in_table
              (ucs4, ucs4len, NULL, profile[i].table);
             if (k != -1)
              return STRINGPREP_CONTAINS_UNASSIGNED;
           }
         break;

       case STRINGPREP_MAP_TABLE:
         if (UNAPPLICAPLEFLAGS (flags, profile[i].flags))
           break;
         rc = stringprep_apply_table_to_string
           (ucs4, &ucs4len, maxucs4len, profile[i].table);
         if (rc != STRINGPREP_OK)
           return rc;
         break;

       case STRINGPREP_BIDI_PROHIBIT_TABLE:
       case STRINGPREP_BIDI_RAL_TABLE:
       case STRINGPREP_BIDI_L_TABLE:
         break;

       case STRINGPREP_BIDI:
         {
           int done_prohibited = 0;
           int done_ral = 0;
           int done_l = 0;
           int contains_ral = -1;
           int contains_l = -1;

           for (j = 0; profile[j].operation; j++)
             if (profile[j].operation == STRINGPREP_BIDI_PROHIBIT_TABLE)
              {
                done_prohibited = 1;
                k = stringprep_find_string_in_table (ucs4, ucs4len,
                                                 NULL,
                                                 profile[j].table);
                if (k != -1)
                  return STRINGPREP_BIDI_CONTAINS_PROHIBITED;
              }
             else if (profile[j].operation == STRINGPREP_BIDI_RAL_TABLE)
              {
                done_ral = 1;
                if (stringprep_find_string_in_table
                    (ucs4, ucs4len, NULL, profile[j].table) != -1)
                  contains_ral = j;
              }
             else if (profile[j].operation == STRINGPREP_BIDI_L_TABLE)
              {
                done_l = 1;
                if (stringprep_find_string_in_table
                    (ucs4, ucs4len, NULL, profile[j].table) != -1)
                  contains_l = j;
              }

           if (!done_prohibited || !done_ral || !done_l)
             return STRINGPREP_PROFILE_ERROR;

           if (contains_ral != -1 && contains_l != -1)
             return STRINGPREP_BIDI_BOTH_L_AND_RAL;

           if (contains_ral != -1)
             {
              if (!(stringprep_find_character_in_table
                    (ucs4[0], profile[contains_ral].table) != -1 &&
                    stringprep_find_character_in_table
                    (ucs4[ucs4len - 1], profile[contains_ral].table) != -1))
                return STRINGPREP_BIDI_LEADTRAIL_NOT_RAL;
             }
         }
         break;

       default:
         return STRINGPREP_PROFILE_ERROR;
         break;
       }
    }

  *len = ucs4len;

  return STRINGPREP_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int stringprep_4zi ( uint32_t ucs4,
size_t  maxucs4len,
Stringprep_profile_flags  flags,
const Stringprep_profile *  profile 
)

stringprep_4zi: : input/output array with zero terminated string to prepare.

: maximum length of input/output array. : stringprep profile flags, or 0. : pointer to stringprep profile to use.

Prepare the input zero terminated UCS-4 string according to the stringprep profile, and write back the result to the input string.

Since the stringprep operation can expand the string, indicate how large the buffer holding the string is. This function will not read or write to code points outside that size.

The are one of Stringprep_profile_flags, or 0.

The contain the instructions to perform. Your application can define new profiles, possibly re-using the generic stringprep tables that always will be part of the library, or use one of the currently supported profiles.

Return value: Returns STRINGPREP_OK iff successful, or an error code.

Definition at line 317 of file stringprep.c.

{
  size_t ucs4len;

  for (ucs4len = 0; ucs4len < maxucs4len && ucs4[ucs4len] != 0; ucs4len++)
    ;

  return stringprep_4zi_1 (ucs4, ucs4len, maxucs4len, flags, profile);
}

Here is the call graph for this function:

const char* stringprep_check_version ( const char *  req_version)
char* stringprep_convert ( const char *  str,
const char *  to_codeset,
const char *  from_codeset 
)

stringprep_convert - encode string using new character set : input zero-terminated string.

: name of destination character set. : name of origin character set, as used by .

Convert the string from one character set to another using the system's iconv() function.

Return value: Returns newly allocated zero-terminated string which is transcoded into to_codeset.

Definition at line 106 of file toutf8.c.

{
#if HAVE_ICONV
  return iconv_string (str, from_codeset, to_codeset);
#else
  char *p;
  fprintf (stderr, "libidn: warning: libiconv not installed, cannot "
          "convert data to UTF-8\n");
  p = malloc (strlen (str) + 1);
  if (!p)
    return NULL;
  return strcpy (p, str);
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

const char* stringprep_locale_charset ( void  )

stringprep_locale_charset - return charset used in current locale

Find out current locale charset. The function respect the CHARSET environment variable, but typically uses nl_langinfo(CODESET) when it is supported. It fall back on "ASCII" if CHARSET isn't set and nl_langinfo isn't supported or return anything.

Note that this function return the application's locale's preferred charset (or thread's locale's preffered charset, if your system support thread-specific locales). It does not return what the system may be using. Thus, if you receive data from external sources you cannot in general use this function to guess what charset it is encoded in. Use stringprep_convert from the external representation into the charset returned by this function, to have data in the locale encoding.

Return value: Return the character set used by the current locale. It will never return NULL, but use "ASCII" as a fallback.

Definition at line 75 of file toutf8.c.

{
  const char *charset = getenv ("CHARSET");      /* flawfinder: ignore */

  if (charset && *charset)
    return charset;

# ifdef LOCALE_WORKS
  charset = nl_langinfo (CODESET);

  if (charset && *charset)
    return charset;
# endif

  return "ASCII";
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* stringprep_locale_to_utf8 ( const char *  str)

stringprep_locale_to_utf8 - convert locale encoded string to UTF-8 : input zero terminated string.

Convert string encoded in the locale's character set into UTF-8 by using stringprep_convert().

Return value: Returns newly allocated zero-terminated string which is transcoded into UTF-8.

Definition at line 133 of file toutf8.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int stringprep_profile ( const char *  in,
char **  out,
const char *  profile,
Stringprep_profile_flags  flags 
)

stringprep_profile: : input array with UTF-8 string to prepare.

: output variable with pointer to newly allocate string. : name of stringprep profile to use. : stringprep profile flags, or 0.

Prepare the input zero terminated UTF-8 string according to the stringprep profile, and return the result in a newly allocated variable.

Note that you must convert strings entered in the systems locale into UTF-8 before using this function, see stringprep_locale_to_utf8().

The output variable must be deallocated by the caller.

The are one of Stringprep_profile_flags, or 0.

The specifies the name of the stringprep profile to use. It must be one of the internally supported stringprep profiles.

Return value: Returns STRINGPREP_OK iff successful, or an error code.

Definition at line 433 of file stringprep.c.

{
  const Stringprep_profiles *p;
  char *str = NULL;
  size_t len = strlen (in) + 1;
  int rc;

  for (p = &stringprep_profiles[0]; p->name; p++)
    if (strcmp (p->name, profile) == 0)
      break;

  if (!p || !p->name || !p->tables)
    return STRINGPREP_UNKNOWN_PROFILE;

  do
    {
      free (str);
      str = (char *) malloc (len);
      if (str == NULL)
       return STRINGPREP_MALLOC_ERROR;

      strcpy (str, in);

      rc = stringprep (str, len, flags, p->tables);
      len += 50;
    }
  while (rc == STRINGPREP_TOO_SMALL_BUFFER);

  if (rc == STRINGPREP_OK)
    *out = str;
  else
    free (str);

  return rc;
}

Here is the call graph for this function:

stringprep_ucs4_nfkc_normalize: : a Unicode string.

: length of array, or -1 if is nul-terminated.

Converts UCS4 string into UTF-8 and runs stringprep_utf8_nfkc_normalize().

Return value: a newly allocated Unicode string, that is the NFKC normalized form of .

Definition at line 1048 of file nfkc.c.

{
  char *p;
  uint32_t *result_wc;

  p = stringprep_ucs4_to_utf8 (str, len, 0, 0);
  result_wc = _g_utf8_normalize_wc (p, -1, G_NORMALIZE_NFKC);
  free (p);

  return result_wc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* stringprep_ucs4_to_utf8 ( const uint32_t str,
ssize_t  len,
size_t items_read,
size_t items_written 
)

stringprep_ucs4_to_utf8: : a UCS-4 encoded string : the maximum length of to use.

If < 0, then the string is terminated with a 0 character. : location to store number of characters read read, or NULL. : location to store number of bytes written or NULL. The value here stored does not include the trailing 0 byte.

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.

Return value: a pointer to a newly allocated UTF-8 string. This value must be freed with free(). If an error occurs, NULL will be returned and set.

Definition at line 1001 of file nfkc.c.

{
  return g_ucs4_to_utf8 (str, len, (glong *) items_read,
                      (glong *) items_written, NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int stringprep_unichar_to_utf8 ( uint32_t  c,
char *  outbuf 
)

stringprep_unichar_to_utf8: : a ISO10646 character code : output buffer, must have at least 6 bytes of space.

  If %NULL, the length will be computed and returned
  and nothing will be written to @outbuf.

Converts a single character to UTF-8.

Return value: number of bytes written.

Definition at line 956 of file nfkc.c.

{
  return g_unichar_to_utf8 (c, outbuf);
}

Here is the call graph for this function:

char* stringprep_utf8_nfkc_normalize ( const char *  str,
ssize_t  len 
)

stringprep_utf8_nfkc_normalize: : a UTF-8 encoded string.

: length of , in bytes, or -1 if is nul-terminated.

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.

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.

Return value: a newly allocated string, that is the NFKC normalized form of .

Definition at line 1031 of file nfkc.c.

Here is the call graph for this function:

char* stringprep_utf8_to_locale ( const char *  str)

stringprep_utf8_to_locale - encode UTF-8 string to locale encoding : input zero terminated string.

Convert string encoded in UTF-8 into the locale's character set by using stringprep_convert().

Return value: Returns newly allocated zero-terminated string which is transcoded into the locale's character set.

Definition at line 149 of file toutf8.c.

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t* stringprep_utf8_to_ucs4 ( const char *  str,
ssize_t  len,
size_t items_written 
)

stringprep_utf8_to_ucs4: : a UTF-8 encoded string : the maximum length of to use.

If < 0, then the string is nul-terminated. : location to store the number of characters in the result, or NULL.

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.

Return value: a pointer to a newly allocated UCS-4 string. This value must be freed with free().

Definition at line 977 of file nfkc.c.

{
  return g_utf8_to_ucs4_fast (str, (glong) len, (glong *) items_written);
}

Here is the call graph for this function:

Here is the caller graph for this function:

stringprep_utf8_to_unichar: : a pointer to Unicode character encoded as UTF-8

Converts a sequence of bytes encoded as UTF-8 to a Unicode character. If does not point to a valid UTF-8 encoded character, results are undefined.

Return value: the resulting character.

Definition at line 939 of file nfkc.c.

{
  return g_utf8_get_char (p);
}

Here is the call graph for this function:


Variable Documentation

const Stringprep_profile stringprep_iscsi[]

Definition at line 244 of file profiles.c.

const Stringprep_profile stringprep_kerberos5[]

Definition at line 60 of file profiles.c.

const Stringprep_profile stringprep_nameprep[]

Definition at line 37 of file profiles.c.

const Stringprep_profile stringprep_plain[]

Definition at line 144 of file profiles.c.

Definition at line 24 of file profiles.c.

Definition at line 11 of file rfc3454.c.

Definition at line 417 of file rfc3454.c.

Definition at line 454 of file rfc3454.c.

Definition at line 1996 of file rfc3454.c.

Definition at line 2947 of file rfc3454.c.

Definition at line 2957 of file rfc3454.c.

Definition at line 2984 of file rfc3454.c.

Definition at line 2996 of file rfc3454.c.

Definition at line 3022 of file rfc3454.c.

Definition at line 3035 of file rfc3454.c.

Definition at line 3063 of file rfc3454.c.

Definition at line 3074 of file rfc3454.c.

Definition at line 3089 of file rfc3454.c.

Definition at line 3100 of file rfc3454.c.

Definition at line 3125 of file rfc3454.c.

Definition at line 3137 of file rfc3454.c.

Definition at line 3181 of file rfc3454.c.

const Stringprep_profile stringprep_saslprep[]

Definition at line 289 of file profiles.c.

const Stringprep_profile stringprep_trace[]

Definition at line 160 of file profiles.c.

const Stringprep_profile stringprep_xmpp_nodeprep[]

Definition at line 97 of file profiles.c.

Definition at line 85 of file profiles.c.

const Stringprep_profile stringprep_xmpp_resourceprep[]

Definition at line 122 of file profiles.c.