idna

Name

idna -- 

Synopsis



#define     IDNA_ACE_PREFIX
int         idna_to_ascii                   (unsigned long *in,
                                             size_t inlen,
                                             char *out,
                                             int allowunassigned,
                                             int usestd3asciirules);
int         idna_to_ascii_from_ucs4         (unsigned long *input,
                                             char **output,
                                             int allowunassigned,
                                             int usestd3asciirules);
int         idna_to_ascii_from_utf8         (const char *input,
                                             char **output,
                                             int allowunassigned,
                                             int usestd3asciirules);
int         idna_to_ascii_from_locale       (const char *input,
                                             char **output,
                                             int allowunassigned,
                                             int usestd3asciirules);
int         idna_to_unicode                 (unsigned long *in,
                                             size_t inlen,
                                             unsigned long *out,
                                             size_t *outlen,
                                             int allowunassigned,
                                             int usestd3asciirules);
int         idna_to_unicode_ucs4_from_ucs4  (unsigned long *input,
                                             unsigned long **output,
                                             int allowunassigned,
                                             int usestd3asciirules);
int         idna_to_unicode_ucs4_from_utf8  (const char *input,
                                             unsigned long **output,
                                             int allowunassigned,
                                             int usestd3asciirules);
int         idna_to_unicode_utf8_from_utf8  (const char *input,
                                             char **output,
                                             int allowunassigned,
                                             int usestd3asciirules);
int         idna_to_unicode_locale_from_utf8
                                            (const char *input,
                                             char **output,
                                             int allowunassigned,
                                             int usestd3asciirules);
int         idna_to_unicode_locale_from_locale
                                            (const char *input,
                                             char **output,
                                             int allowunassigned,
                                             int usestd3asciirules);
int         idna_ucs4_to_ace                (unsigned long *input,
                                             char **output);
int         idna_utf8_to_ace                (const char *input,
                                             char **output);
int         idna_locale_to_ace              (const char *input,
                                             char **output);
int         idna_ucs4ace_to_ucs4            (unsigned long *input,
                                             unsigned long **output);
int         idna_utf8ace_to_ucs4            (const char *input,
                                             unsigned long **output);
int         idna_utf8ace_to_utf8            (const char *input,
                                             char **output);
int         idna_utf8ace_to_locale          (const char *input,
                                             char **output);
int         idna_localeace_to_locale        (const char *input,
                                             char **output);

Description

Details

IDNA_ACE_PREFIX

#define     IDNA_ACE_PREFIX


idna_to_ascii ()

int         idna_to_ascii                   (unsigned long *in,
                                             size_t inlen,
                                             char *out,
                                             int allowunassigned,
                                             int usestd3asciirules);

The ToASCII operation takes a sequence of Unicode code points that make up one label and transforms it into a sequence of code points in the ASCII range (0..7F). If ToASCII succeeds, the original sequence and the resulting sequence are equivalent labels.

It is important to note that the ToASCII operation can fail. ToASCII fails if any step of it fails. If any step of the ToASCII operation fails on any label in a domain name, that domain name MUST NOT be used as an internationalized domain name. The method for deadling with this failure is application-specific.

The inputs to ToASCII are a sequence of code points, the AllowUnassigned flag, and the UseSTD3ASCIIRules flag. The output of ToASCII is either a sequence of ASCII code points or a failure condition.

ToASCII never alters a sequence of code points that are all in the ASCII range to begin with (although it could fail). Applying the ToASCII operation multiple times has exactly the same effect as applying it just once.

in :

input array with unicode code points.

inlen :

length of input array with unicode code points.

out :

output zero terminated string that must have room for at least 63 characters plus the terminating zero.

allowunassigned :

whether to allow unassigned code points.

usestd3asciirules :

whether to check input for STD3 compliance.

Returns :

Returns 0 on success, or an error code.


idna_to_ascii_from_ucs4 ()

int         idna_to_ascii_from_ucs4         (unsigned long *input,
                                             char **output,
                                             int allowunassigned,
                                             int usestd3asciirules);

Convert UCS-4 domain name to ASCII string. The domain name may contain several labels, separated by dots. The output buffer must be deallocated by the caller.

input :

zero terminated input Unicode string.

output :

pointer to newly allocated output string.

allowunassigned :

whether to allow unassigned code points.

usestd3asciirules :

whether to check input for STD3 compliance.

Returns :

Returns IDNA_SUCCESS on success, or error code.


idna_to_ascii_from_utf8 ()

int         idna_to_ascii_from_utf8         (const char *input,
                                             char **output,
                                             int allowunassigned,
                                             int usestd3asciirules);

Convert UTF-8 domain name to ASCII string. The domain name may contain several labels, separated by dots. The output buffer must be deallocated by the caller.

input :

zero terminated input UTF-8 string.

output :

pointer to newly allocated output string.

allowunassigned :

whether to allow unassigned code points.

usestd3asciirules :

whether to check input for STD3 compliance.

Returns :

Returns IDNA_SUCCESS on success, or error code.


idna_to_ascii_from_locale ()

int         idna_to_ascii_from_locale       (const char *input,
                                             char **output,
                                             int allowunassigned,
                                             int usestd3asciirules);

Convert domain name in the locale's encoding to ASCII string. The domain name may contain several labels, separated by dots. The output buffer must be deallocated by the caller.

input :

zero terminated input UTF-8 string.

output :

pointer to newly allocated output string.

allowunassigned :

whether to allow unassigned code points.

usestd3asciirules :

whether to check input for STD3 compliance.

Returns :

Returns IDNA_SUCCESS on success, or error code.


idna_to_unicode ()

int         idna_to_unicode                 (unsigned long *in,
                                             size_t inlen,
                                             unsigned long *out,
                                             size_t *outlen,
                                             int allowunassigned,
                                             int usestd3asciirules);

The ToUnicode operation takes a sequence of Unicode code points that make up one label and returns a sequence of Unicode code points. If the input sequence is a label in ACE form, then the result is an equivalent internationalized label that is not in ACE form, otherwise the original sequence is returned unaltered.

ToUnicode never fails. If any step fails, then the original input sequence is returned immediately in that step.

The ToUnicode output never contains more code points than its input. Note that the number of octets needed to represent a sequence of code points depends on the particular character encoding used.

The inputs to ToUnicode are a sequence of code points, the AllowUnassigned flag, and the UseSTD3ASCIIRules flag. The output of ToUnicode is always a sequence of Unicode code points.

in :

input array with unicode code points.

inlen :

length of input array with unicode code points.

out :

output array with unicode code points.

outlen :

on input, maximum size of output array with unicode code points, on exit, actual size of output array with unicode code points.

allowunassigned :

whether to allow unassigned code points.

usestd3asciirules :

whether to check input for STD3 compliance.

Returns :

Returns error condition, but it must only be used for debugging purposes. The output buffer is always guaranteed to contain the correct data according to the specification (sans malloc induced errors). NB! This means that you normally ignore the return code from this function, as checking it means breaking the standard.


idna_to_unicode_ucs4_from_ucs4 ()

int         idna_to_unicode_ucs4_from_ucs4  (unsigned long *input,
                                             unsigned long **output,
                                             int allowunassigned,
                                             int usestd3asciirules);

Convert possibly ACE encoded domain name in UCS-4 format into a UCS-4 string. The domain name may contain several labels, separated by dots. The output buffer must be deallocated by the caller.

input :

zero-terminated Unicode string.

output :

pointer to newly allocated output Unicode string.

allowunassigned :

whether to allow unassigned code points.

usestd3asciirules :

whether to check input for STD3 compliance.

Returns :

Returns IDNA_SUCCESS on success, or error code.


idna_to_unicode_ucs4_from_utf8 ()

int         idna_to_unicode_ucs4_from_utf8  (const char *input,
                                             unsigned long **output,
                                             int allowunassigned,
                                             int usestd3asciirules);

Convert possibly ACE encoded domain name in UTF-8 format into a UCS-4 string. The domain name may contain several labels, separated by dots. The output buffer must be deallocated by the caller.

input :

zero-terminated UTF-8 string.

output :

pointer to newly allocated output Unicode string.

allowunassigned :

whether to allow unassigned code points.

usestd3asciirules :

whether to check input for STD3 compliance.

Returns :

Returns IDNA_SUCCESS on success, or error code.


idna_to_unicode_utf8_from_utf8 ()

int         idna_to_unicode_utf8_from_utf8  (const char *input,
                                             char **output,
                                             int allowunassigned,
                                             int usestd3asciirules);

Convert possibly ACE encoded domain name in UTF-8 format into a UTF-8 string. The domain name may contain several labels, separated by dots. The output buffer must be deallocated by the caller.

input :

zero-terminated UTF-8 string.

output :

pointer to newly allocated output UTF-8 string.

allowunassigned :

whether to allow unassigned code points.

usestd3asciirules :

whether to check input for STD3 compliance.

Returns :

Returns IDNA_SUCCESS on success, or error code.


idna_to_unicode_locale_from_utf8 ()

int         idna_to_unicode_locale_from_utf8
                                            (const char *input,
                                             char **output,
                                             int allowunassigned,
                                             int usestd3asciirules);

Convert possibly ACE encoded domain name in UTF-8 format into a string encoded in the current locale's character set. The The domain name may contain several labels, separated by dots. The output buffer must be deallocated by the caller.

input :

zero-terminated UTF-8 string.

output :

pointer to newly allocated output string encoded in the current locale's character set.

allowunassigned :

whether to allow unassigned code points.

usestd3asciirules :

whether to check input for STD3 compliance.

Returns :

Returns IDNA_SUCCESS on success, or error code.


idna_to_unicode_locale_from_locale ()

int         idna_to_unicode_locale_from_locale
                                            (const char *input,
                                             char **output,
                                             int allowunassigned,
                                             int usestd3asciirules);

Convert possibly ACE encoded domain name in the locale's character set into a string encoded in the current locale's character set. The domain name may contain several labels, separated by dots. The output buffer must be deallocated by the caller.

input :

zero-terminated string encoded in the current locale's character set.

output :

pointer to newly allocated output string encoded in the current locale's character set.

allowunassigned :

whether to allow unassigned code points.

usestd3asciirules :

whether to check input for STD3 compliance.

Returns :

Returns IDNA_SUCCESS on success, or error code.


idna_ucs4_to_ace ()

int         idna_ucs4_to_ace                (unsigned long *input,
                                             char **output);

input :

output :

Returns :


idna_utf8_to_ace ()

int         idna_utf8_to_ace                (const char *input,
                                             char **output);

input :

output :

Returns :


idna_locale_to_ace ()

int         idna_locale_to_ace              (const char *input,
                                             char **output);

input :

output :

Returns :


idna_ucs4ace_to_ucs4 ()

int         idna_ucs4ace_to_ucs4            (unsigned long *input,
                                             unsigned long **output);

input :

output :

Returns :


idna_utf8ace_to_ucs4 ()

int         idna_utf8ace_to_ucs4            (const char *input,
                                             unsigned long **output);

input :

output :

Returns :


idna_utf8ace_to_utf8 ()

int         idna_utf8ace_to_utf8            (const char *input,
                                             char **output);

input :

output :

Returns :


idna_utf8ace_to_locale ()

int         idna_utf8ace_to_locale          (const char *input,
                                             char **output);

input :

output :

Returns :


idna_localeace_to_locale ()

int         idna_localeace_to_locale        (const char *input,
                                             char **output);

input :

output :

Returns :