idna.c.texi   [plain text]


@subheading idna_to_ascii_4i
@anchor{idna_to_ascii_4i}
@deftypefun {int} {idna_to_ascii_4i} (const uint32_t * @var{in}, size_t @var{inlen}, char * @var{out}, int @var{flags})
@var{in}: input array with unicode code points.

@var{inlen}: length of input array with unicode code points.

@var{out}: output zero terminated string that must have room for at
least 63 characters plus the terminating zero.

@var{flags}: an @code{Idna_flags} value, e.g., @code{IDNA_ALLOW_UNASSIGNED} or
@code{IDNA_USE_STD3_ASCII_RULES}.

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.

@strong{Return value:} Returns 0 on success, or an @code{Idna_rc} error code.
@end deftypefun

@subheading idna_to_unicode_44i
@anchor{idna_to_unicode_44i}
@deftypefun {int} {idna_to_unicode_44i} (const uint32_t * @var{in}, size_t @var{inlen}, uint32_t * @var{out}, size_t * @var{outlen}, int @var{flags})
@var{in}: input array with unicode code points.

@var{inlen}: length of input array with unicode code points.

@var{out}: output array with unicode code points.

@var{outlen}: on input, maximum size of output array with unicode code points,
on exit, actual size of output array with unicode code points.

@var{flags}: an @code{Idna_flags} value, e.g., @code{IDNA_ALLOW_UNASSIGNED} or
@code{IDNA_USE_STD3_ASCII_RULES}.

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 Punycode decoder can never output more code points than it
inputs, but Nameprep can, and therefore ToUnicode can.  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.

@strong{Return value:} Returns @code{Idna_rc} 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.
@end deftypefun

@subheading idna_to_ascii_4z
@anchor{idna_to_ascii_4z}
@deftypefun {int} {idna_to_ascii_4z} (const uint32_t * @var{input}, char ** @var{output}, int @var{flags})
@var{input}: zero terminated input Unicode string.

@var{output}: pointer to newly allocated output string.

@var{flags}: an @code{Idna_flags} value, e.g., @code{IDNA_ALLOW_UNASSIGNED} or
@code{IDNA_USE_STD3_ASCII_RULES}.

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.

@strong{Return value:} Returns @code{IDNA_SUCCESS} on success, or error code.
@end deftypefun

@subheading idna_to_ascii_8z
@anchor{idna_to_ascii_8z}
@deftypefun {int} {idna_to_ascii_8z} (const char * @var{input}, char ** @var{output}, int @var{flags})
@var{input}: zero terminated input UTF-8 string.

@var{output}: pointer to newly allocated output string.

@var{flags}: an @code{Idna_flags} value, e.g., @code{IDNA_ALLOW_UNASSIGNED} or
@code{IDNA_USE_STD3_ASCII_RULES}.

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.

@strong{Return value:} Returns @code{IDNA_SUCCESS} on success, or error code.
@end deftypefun

@subheading idna_to_ascii_lz
@anchor{idna_to_ascii_lz}
@deftypefun {int} {idna_to_ascii_lz} (const char * @var{input}, char ** @var{output}, int @var{flags})
@var{input}: zero terminated input string encoded in the current locale's
character set.

@var{output}: pointer to newly allocated output string.

@var{flags}: an @code{Idna_flags} value, e.g., @code{IDNA_ALLOW_UNASSIGNED} or
@code{IDNA_USE_STD3_ASCII_RULES}.

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.

@strong{Return value:} Returns @code{IDNA_SUCCESS} on success, or error code.
@end deftypefun

@subheading idna_to_unicode_4z4z
@anchor{idna_to_unicode_4z4z}
@deftypefun {int} {idna_to_unicode_4z4z} (const uint32_t * @var{input}, uint32_t ** @var{output}, int @var{flags})
@var{input}: zero-terminated Unicode string.

@var{output}: pointer to newly allocated output Unicode string.

@var{flags}: an @code{Idna_flags} value, e.g., @code{IDNA_ALLOW_UNASSIGNED} or
@code{IDNA_USE_STD3_ASCII_RULES}.

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.

@strong{Return value:} Returns @code{IDNA_SUCCESS} on success, or error code.
@end deftypefun

@subheading idna_to_unicode_8z4z
@anchor{idna_to_unicode_8z4z}
@deftypefun {int} {idna_to_unicode_8z4z} (const char * @var{input}, uint32_t ** @var{output}, int @var{flags})
@var{input}: zero-terminated UTF-8 string.

@var{output}: pointer to newly allocated output Unicode string.

@var{flags}: an @code{Idna_flags} value, e.g., @code{IDNA_ALLOW_UNASSIGNED} or
@code{IDNA_USE_STD3_ASCII_RULES}.

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.

@strong{Return value:} Returns @code{IDNA_SUCCESS} on success, or error code.
@end deftypefun

@subheading idna_to_unicode_8z8z
@anchor{idna_to_unicode_8z8z}
@deftypefun {int} {idna_to_unicode_8z8z} (const char * @var{input}, char ** @var{output}, int @var{flags})
@var{input}: zero-terminated UTF-8 string.

@var{output}: pointer to newly allocated output UTF-8 string.

@var{flags}: an @code{Idna_flags} value, e.g., @code{IDNA_ALLOW_UNASSIGNED} or
@code{IDNA_USE_STD3_ASCII_RULES}.

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.

@strong{Return value:} Returns @code{IDNA_SUCCESS} on success, or error code.
@end deftypefun

@subheading idna_to_unicode_8zlz
@anchor{idna_to_unicode_8zlz}
@deftypefun {int} {idna_to_unicode_8zlz} (const char * @var{input}, char ** @var{output}, int @var{flags})
@var{input}: zero-terminated UTF-8 string.

@var{output}: pointer to newly allocated output string encoded in the
current locale's character set.

@var{flags}: an @code{Idna_flags} value, e.g., @code{IDNA_ALLOW_UNASSIGNED} or
@code{IDNA_USE_STD3_ASCII_RULES}.

Convert possibly ACE encoded domain name in UTF-8 format 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.

@strong{Return value:} Returns @code{IDNA_SUCCESS} on success, or error code.
@end deftypefun

@subheading idna_to_unicode_lzlz
@anchor{idna_to_unicode_lzlz}
@deftypefun {int} {idna_to_unicode_lzlz} (const char * @var{input}, char ** @var{output}, int @var{flags})
@var{input}: zero-terminated string encoded in the current locale's
character set.

@var{output}: pointer to newly allocated output string encoded in the
current locale's character set.

@var{flags}: an @code{Idna_flags} value, e.g., @code{IDNA_ALLOW_UNASSIGNED} or
@code{IDNA_USE_STD3_ASCII_RULES}.

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.

@strong{Return value:} Returns @code{IDNA_SUCCESS} on success, or error code.
@end deftypefun