X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..48b980fed3435926e0b3a8d72ecb58be703a1c7a:/icuSources/common/unicode/uidna.h?ds=inline diff --git a/icuSources/common/unicode/uidna.h b/icuSources/common/unicode/uidna.h index 7470621c..52aa6e91 100644 --- a/icuSources/common/unicode/uidna.h +++ b/icuSources/common/unicode/uidna.h @@ -1,7 +1,7 @@ /* ******************************************************************************* * - * Copyright (C) 2003, International Business Machines + * Copyright (C) 2003-2007, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -24,7 +24,9 @@ #include "unicode/parseerr.h" /** - *\file + * \file + * \brief C API: Internationalized Domain Names in Applications Tranformation + * * UIDNA API implements the IDNA protocol as defined in the IDNA RFC * (http://www.ietf.org/rfc/rfc3490.txt). * The RFC defines 2 operations: ToASCII and ToUnicode. Domain labels @@ -44,7 +46,7 @@ * once. * ToUnicode(ToUnicode(ToUnicode...(ToUnicode(string)))) == ToUnicode(string) * ToASCII(ToASCII(ToASCII...(ToASCII(string))) == ToASCII(string). - *\end_file + * */ /** @@ -52,24 +54,24 @@ * do not check if the input conforms to STD-3 ASCII rules. * * @see uidna_toASCII uidna_toUnicode - * @draft ICU 2.6 + * @stable ICU 2.6 */ #define UIDNA_DEFAULT 0x0000 /** * Option to allow processing of unassigned codepoints in the input * * @see uidna_toASCII uidna_toUnicode - * @draft ICU 2.6 + * @stable ICU 2.6 */ #define UIDNA_ALLOW_UNASSIGNED 0x0001 /** * Option to check if input conforms to STD-3 ASCII rules * * @see uidna_toASCII uidna_toUnicode - * @draft ICU 2.6 + * @stable ICU 2.6 */ #define UIDNA_USE_STD3_RULES 0x0002 - + /** * This function implements the ToASCII operation as defined in the IDNA RFC. * This operation is done on single labels before sending it to something that expects @@ -84,18 +86,18 @@ * @param destCapacity Size of dest. * @param options A bit set of options: * - * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points - * and do not use STD3 ASCII rules - * If unassigned code points are found the operation fails with - * U_UNASSIGNED_CODE_POINT_FOUND error code. + * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points + * and do not use STD3 ASCII rules + * If unassigned code points are found the operation fails with + * U_UNASSIGNED_ERROR error code. * - * - UIDNA_UNASSIGNED Unassigned values can be converted to ASCII for query operations - * If this option is set, the unassigned code points are in the input - * are treated as normal Unicode code points. + * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations + * If this option is set, the unassigned code points are in the input + * are treated as normal Unicode code points. * - * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions - * If this option is set and the input does not satisfy STD3 rules, - * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR + * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions + * If this option is set and the input does not satisfy STD3 rules, + * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR * * @param parseError Pointer to UParseError struct to receive information on position * of error if an error is encountered. Can be NULL. @@ -105,10 +107,11 @@ * U_INDEX_OUTOFBOUNDS_ERROR if src contains * too many code points. * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough - * @return Number of ASCII characters converted. - * @draft ICU 2.6 + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * @stable ICU 2.6 */ -U_CAPI int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uidna_toASCII(const UChar* src, int32_t srcLength, UChar* dest, int32_t destCapacity, int32_t options, @@ -129,23 +132,23 @@ uidna_toASCII(const UChar* src, int32_t srcLength, * @param destCapacity Size of dest. * @param options A bit set of options: * - * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points - * and do not use STD3 ASCII rules - * If unassigned code points are found the operation fails with - * U_UNASSIGNED_CODE_POINT_FOUND error code. + * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points + * and do not use STD3 ASCII rules + * If unassigned code points are found the operation fails with + * U_UNASSIGNED_ERROR error code. * - * - UIDNA_UNASSIGNED Unassigned values can be converted to ASCII for query operations - * If this option is set, the unassigned code points are in the input - * are treated as normal Unicode code points. Note: This option is - * required on toUnicode operation because the RFC mandates - * verification of decoded ACE input by applying toASCII and comparing - * its output with source + * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations + * If this option is set, the unassigned code points are in the input + * are treated as normal Unicode code points. Note: This option is + * required on toUnicode operation because the RFC mandates + * verification of decoded ACE input by applying toASCII and comparing + * its output with source * * * - * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions - * If this option is set and the input does not satisfy STD3 rules, - * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR + * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions + * If this option is set and the input does not satisfy STD3 rules, + * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR * * @param parseError Pointer to UParseError struct to receive information on position * of error if an error is encountered. Can be NULL. @@ -155,10 +158,11 @@ uidna_toASCII(const UChar* src, int32_t srcLength, * U_INDEX_OUTOFBOUNDS_ERROR if src contains * too many code points. * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough - * @return Number of Unicode characters converted. - * @draft ICU 2.6 + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * @stable ICU 2.6 */ -U_CAPI int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uidna_toUnicode(const UChar* src, int32_t srcLength, UChar* dest, int32_t destCapacity, int32_t options, @@ -184,18 +188,18 @@ uidna_toUnicode(const UChar* src, int32_t srcLength, * @param destCapacity Size of dest. * @param options A bit set of options: * - * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points - * and do not use STD3 ASCII rules - * If unassigned code points are found the operation fails with - * U_UNASSIGNED_CODE_POINT_FOUND error code. + * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points + * and do not use STD3 ASCII rules + * If unassigned code points are found the operation fails with + * U_UNASSIGNED_CODE_POINT_FOUND error code. * - * - UIDNA_UNASSIGNED Unassigned values can be converted to ASCII for query operations - * If this option is set, the unassigned code points are in the input - * are treated as normal Unicode code points. + * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations + * If this option is set, the unassigned code points are in the input + * are treated as normal Unicode code points. * - * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions - * If this option is set and the input does not satisfy STD3 rules, - * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR + * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions + * If this option is set and the input does not satisfy STD3 rules, + * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR * * @param parseError Pointer to UParseError struct to receive information on position * of error if an error is encountered. Can be NULL. @@ -205,10 +209,11 @@ uidna_toUnicode(const UChar* src, int32_t srcLength, * U_INDEX_OUTOFBOUNDS_ERROR if src contains * too many code points. * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough - * @return Number of ASCII characters converted. - * @draft ICU 2.6 + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * @stable ICU 2.6 */ -U_CAPI int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uidna_IDNToASCII( const UChar* src, int32_t srcLength, UChar* dest, int32_t destCapacity, int32_t options, @@ -230,18 +235,18 @@ uidna_IDNToASCII( const UChar* src, int32_t srcLength, * @param destCapacity Size of dest. * @param options A bit set of options: * - * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points - * and do not use STD3 ASCII rules - * If unassigned code points are found the operation fails with - * U_UNASSIGNED_CODE_POINT_FOUND error code. + * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points + * and do not use STD3 ASCII rules + * If unassigned code points are found the operation fails with + * U_UNASSIGNED_CODE_POINT_FOUND error code. * - * - UIDNA_UNASSIGNED Unassigned values can be converted to ASCII for query operations - * If this option is set, the unassigned code points are in the input - * are treated as normal Unicode code points. + * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations + * If this option is set, the unassigned code points are in the input + * are treated as normal Unicode code points. * - * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions - * If this option is set and the input does not satisfy STD3 rules, - * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR + * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions + * If this option is set and the input does not satisfy STD3 rules, + * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR * * @param parseError Pointer to UParseError struct to receive information on position * of error if an error is encountered. Can be NULL. @@ -251,10 +256,11 @@ uidna_IDNToASCII( const UChar* src, int32_t srcLength, * U_INDEX_OUTOFBOUNDS_ERROR if src contains * too many code points. * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough - * @return Number of ASCII characters converted. - * @draft ICU 2.6 + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * @stable ICU 2.6 */ -U_CAPI int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uidna_IDNToUnicode( const UChar* src, int32_t srcLength, UChar* dest, int32_t destCapacity, int32_t options, @@ -262,7 +268,7 @@ uidna_IDNToUnicode( const UChar* src, int32_t srcLength, UErrorCode* status); /** - * Compare two strings for IDNs for equivalence. + * Compare two IDN strings for equivalence. * This function splits the domain names into labels and compares them. * According to IDN RFC, whenever two labels are compared, they are * considered equal if and only if their ASCII forms (obtained by @@ -277,25 +283,25 @@ uidna_IDNToUnicode( const UChar* src, int32_t srcLength, * @param length2 Length of second source string, or -1 if NUL-terminated. * @param options A bit set of options: * - * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points - * and do not use STD3 ASCII rules - * If unassigned code points are found the operation fails with - * U_UNASSIGNED_CODE_POINT_FOUND error code. + * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points + * and do not use STD3 ASCII rules + * If unassigned code points are found the operation fails with + * U_UNASSIGNED_CODE_POINT_FOUND error code. * - * - UIDNA_UNASSIGNED Unassigned values can be converted to ASCII for query operations - * If this option is set, the unassigned code points are in the input - * are treated as normal Unicode code points. + * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations + * If this option is set, the unassigned code points are in the input + * are treated as normal Unicode code points. * - * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions - * If this option is set and the input does not satisfy STD3 rules, - * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR + * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions + * If this option is set and the input does not satisfy STD3 rules, + * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR * * @param status ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return <0 or 0 or >0 as usual for string comparisons - * @draft ICU 2.6 + * @stable ICU 2.6 */ -U_CAPI int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uidna_compare( const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, int32_t options,