X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/729e4ab9bc6618bc3d8a898e575df7f4019e29ca..08b89b0a244153b9f5bbb2f49c55ab0f7298122e:/icuSources/common/unicode/uidna.h diff --git a/icuSources/common/unicode/uidna.h b/icuSources/common/unicode/uidna.h index 04b439d9..2efb130f 100644 --- a/icuSources/common/unicode/uidna.h +++ b/icuSources/common/unicode/uidna.h @@ -1,7 +1,7 @@ /* ******************************************************************************* * - * Copyright (C) 2003-2010, International Business Machines + * Copyright (C) 2003-2013, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -42,12 +42,14 @@ enum { /** * Default options value: None of the other options are set. + * For use in static worker and factory methods. * @stable ICU 2.6 */ UIDNA_DEFAULT=0, /** * Option to allow unassigned code points in domain names and labels. - * This option is ignored by the UTS46 implementation. + * For use in static worker and factory methods. + *

This option is ignored by the UTS46 implementation. * (UTS #46 disallows unassigned code points.) * @stable ICU 2.6 */ @@ -56,47 +58,62 @@ enum { * Option to check whether the input conforms to the STD3 ASCII rules, * for example the restriction of labels to LDH characters * (ASCII Letters, Digits and Hyphen-Minus). + * For use in static worker and factory methods. * @stable ICU 2.6 */ UIDNA_USE_STD3_RULES=2, /** * IDNA option to check for whether the input conforms to the BiDi rules. - * This option is ignored by the IDNA2003 implementation. + * For use in static worker and factory methods. + *

This option is ignored by the IDNA2003 implementation. * (IDNA2003 always performs a BiDi check.) - * @draft ICU 4.6 + * @stable ICU 4.6 */ UIDNA_CHECK_BIDI=4, /** * IDNA option to check for whether the input conforms to the CONTEXTJ rules. - * This option is ignored by the IDNA2003 implementation. + * For use in static worker and factory methods. + *

This option is ignored by the IDNA2003 implementation. * (The CONTEXTJ check is new in IDNA2008.) - * @draft ICU 4.6 + * @stable ICU 4.6 */ UIDNA_CHECK_CONTEXTJ=8, /** * IDNA option for nontransitional processing in ToASCII(). - * By default, ToASCII() uses transitional processing. - * This option is ignored by the IDNA2003 implementation. + * For use in static worker and factory methods. + *

By default, ToASCII() uses transitional processing. + *

This option is ignored by the IDNA2003 implementation. * (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.) - * @draft ICU 4.6 + * @stable ICU 4.6 */ UIDNA_NONTRANSITIONAL_TO_ASCII=0x10, /** * IDNA option for nontransitional processing in ToUnicode(). - * By default, ToUnicode() uses transitional processing. - * This option is ignored by the IDNA2003 implementation. + * For use in static worker and factory methods. + *

By default, ToUnicode() uses transitional processing. + *

This option is ignored by the IDNA2003 implementation. * (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.) - * @draft ICU 4.6 + * @stable ICU 4.6 */ - UIDNA_NONTRANSITIONAL_TO_UNICODE=0x20 + UIDNA_NONTRANSITIONAL_TO_UNICODE=0x20, + /** + * IDNA option to check for whether the input conforms to the CONTEXTO rules. + * For use in static worker and factory methods. + *

This option is ignored by the IDNA2003 implementation. + * (The CONTEXTO check is new in IDNA2008.) + *

This is for use by registries for IDNA2008 conformance. + * UTS #46 does not require the CONTEXTO check. + * @stable ICU 49 + */ + UIDNA_CHECK_CONTEXTO=0x40 }; /** * Opaque C service object type for the new IDNA API. - * @draft ICU 4.6 + * @stable ICU 4.6 */ struct UIDNA; -typedef struct UIDNA UIDNA; /**< C typedef for struct UIDNA. @draft ICU 4.6 */ +typedef struct UIDNA UIDNA; /**< C typedef for struct UIDNA. @stable ICU 4.6 */ /** * Returns a UIDNA instance which implements UTS #46. @@ -113,17 +130,17 @@ typedef struct UIDNA UIDNA; /**< C typedef for struct UIDNA. @draft ICU 4.6 */ * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return the UTS #46 UIDNA instance, if successful - * @draft ICU 4.6 + * @stable ICU 4.6 */ -U_DRAFT UIDNA * U_EXPORT2 +U_STABLE UIDNA * U_EXPORT2 uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode); /** * Closes a UIDNA instance. * @param idna UIDNA instance to be closed - * @draft ICU 4.6 + * @stable ICU 4.6 */ -U_DRAFT void U_EXPORT2 +U_STABLE void U_EXPORT2 uidna_close(UIDNA *idna); #if U_SHOW_CPLUSPLUS_API @@ -137,7 +154,7 @@ U_NAMESPACE_BEGIN * * @see LocalPointerBase * @see LocalPointer - * @draft ICU 4.6 + * @stable ICU 4.6 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUIDNAPointer, UIDNA, uidna_close); @@ -153,32 +170,31 @@ U_NAMESPACE_END * int32_t length = uidna_nameToASCII(..., &info, &errorCode); * if(U_SUCCESS(errorCode) && info.errors!=0) { ... } * \endcode - * @draft ICU 4.6 + * @stable ICU 4.6 */ -struct UIDNAInfo { - /** sizeof(UIDNAInfo) @draft ICU 4.6 */ +typedef struct UIDNAInfo { + /** sizeof(UIDNAInfo) @stable ICU 4.6 */ int16_t size; /** * Set to TRUE if transitional and nontransitional processing produce different results. * For details see C++ IDNAInfo::isTransitionalDifferent(). - * @draft ICU 4.6 + * @stable ICU 4.6 */ UBool isTransitionalDifferent; UBool reservedB3; /**< Reserved field, do not use. @internal */ /** * Bit set indicating IDNA processing errors. 0 if no errors. * See UIDNA_ERROR_... constants. - * @draft ICU 4.6 + * @stable ICU 4.6 */ uint32_t errors; int32_t reservedI2; /**< Reserved field, do not use. @internal */ int32_t reservedI3; /**< Reserved field, do not use. @internal */ -}; -typedef struct UIDNAInfo UIDNAInfo; +} UIDNAInfo; /** * Static initializer for a UIDNAInfo struct. - * @draft ICU 4.6 + * @stable ICU 4.6 */ #define UIDNA_INFO_INITIALIZER { \ (int16_t)sizeof(UIDNAInfo), \ @@ -206,9 +222,9 @@ typedef struct UIDNAInfo UIDNAInfo; * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length - * @draft ICU 4.6 + * @stable ICU 4.6 */ -U_DRAFT int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uidna_labelToASCII(const UIDNA *idna, const UChar *label, int32_t length, UChar *dest, int32_t capacity, @@ -233,9 +249,9 @@ uidna_labelToASCII(const UIDNA *idna, * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length - * @draft ICU 4.6 + * @stable ICU 4.6 */ -U_DRAFT int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uidna_labelToUnicode(const UIDNA *idna, const UChar *label, int32_t length, UChar *dest, int32_t capacity, @@ -262,9 +278,9 @@ uidna_labelToUnicode(const UIDNA *idna, * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length - * @draft ICU 4.6 + * @stable ICU 4.6 */ -U_DRAFT int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uidna_nameToASCII(const UIDNA *idna, const UChar *name, int32_t length, UChar *dest, int32_t capacity, @@ -289,9 +305,9 @@ uidna_nameToASCII(const UIDNA *idna, * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length - * @draft ICU 4.6 + * @stable ICU 4.6 */ -U_DRAFT int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uidna_nameToUnicode(const UIDNA *idna, const UChar *name, int32_t length, UChar *dest, int32_t capacity, @@ -314,9 +330,9 @@ uidna_nameToUnicode(const UIDNA *idna, * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length - * @draft ICU 4.6 + * @stable ICU 4.6 */ -U_DRAFT int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uidna_labelToASCII_UTF8(const UIDNA *idna, const char *label, int32_t length, char *dest, int32_t capacity, @@ -337,9 +353,9 @@ uidna_labelToASCII_UTF8(const UIDNA *idna, * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length - * @draft ICU 4.6 + * @stable ICU 4.6 */ -U_DRAFT int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uidna_labelToUnicodeUTF8(const UIDNA *idna, const char *label, int32_t length, char *dest, int32_t capacity, @@ -360,9 +376,9 @@ uidna_labelToUnicodeUTF8(const UIDNA *idna, * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length - * @draft ICU 4.6 + * @stable ICU 4.6 */ -U_DRAFT int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uidna_nameToASCII_UTF8(const UIDNA *idna, const char *name, int32_t length, char *dest, int32_t capacity, @@ -383,9 +399,9 @@ uidna_nameToASCII_UTF8(const UIDNA *idna, * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length - * @draft ICU 4.6 + * @stable ICU 4.6 */ -U_DRAFT int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uidna_nameToUnicodeUTF8(const UIDNA *idna, const char *name, int32_t length, char *dest, int32_t capacity, @@ -399,58 +415,58 @@ uidna_nameToUnicodeUTF8(const UIDNA *idna, enum { /** * A non-final domain name label (or the whole domain name) is empty. - * @draft ICU 4.6 + * @stable ICU 4.6 */ UIDNA_ERROR_EMPTY_LABEL=1, /** * A domain name label is longer than 63 bytes. * (See STD13/RFC1034 3.1. Name space specifications and terminology.) * This is only checked in ToASCII operations, and only if the output label is all-ASCII. - * @draft ICU 4.6 + * @stable ICU 4.6 */ UIDNA_ERROR_LABEL_TOO_LONG=2, /** * A domain name is longer than 255 bytes in its storage form. * (See STD13/RFC1034 3.1. Name space specifications and terminology.) * This is only checked in ToASCII operations, and only if the output domain name is all-ASCII. - * @draft ICU 4.6 + * @stable ICU 4.6 */ UIDNA_ERROR_DOMAIN_NAME_TOO_LONG=4, /** * A label starts with a hyphen-minus ('-'). - * @draft ICU 4.6 + * @stable ICU 4.6 */ UIDNA_ERROR_LEADING_HYPHEN=8, /** * A label ends with a hyphen-minus ('-'). - * @draft ICU 4.6 + * @stable ICU 4.6 */ UIDNA_ERROR_TRAILING_HYPHEN=0x10, /** * A label contains hyphen-minus ('-') in the third and fourth positions. - * @draft ICU 4.6 + * @stable ICU 4.6 */ UIDNA_ERROR_HYPHEN_3_4=0x20, /** * A label starts with a combining mark. - * @draft ICU 4.6 + * @stable ICU 4.6 */ UIDNA_ERROR_LEADING_COMBINING_MARK=0x40, /** * A label or domain name contains disallowed characters. - * @draft ICU 4.6 + * @stable ICU 4.6 */ UIDNA_ERROR_DISALLOWED=0x80, /** * A label starts with "xn--" but does not contain valid Punycode. * That is, an xn-- label failed Punycode decoding. - * @draft ICU 4.6 + * @stable ICU 4.6 */ UIDNA_ERROR_PUNYCODE=0x100, /** * A label contains a dot=full stop. * This can occur in an input string for a single-label function. - * @draft ICU 4.6 + * @stable ICU 4.6 */ UIDNA_ERROR_LABEL_HAS_DOT=0x200, /** @@ -459,19 +475,32 @@ enum { * string had severe validation errors. For example, * it might contain characters that are not allowed in ACE labels, * or it might not be normalized. - * @draft ICU 4.6 + * @stable ICU 4.6 */ UIDNA_ERROR_INVALID_ACE_LABEL=0x400, /** * A label does not meet the IDNA BiDi requirements (for right-to-left characters). - * @draft ICU 4.6 + * @stable ICU 4.6 */ UIDNA_ERROR_BIDI=0x800, /** * A label does not meet the IDNA CONTEXTJ requirements. - * @draft ICU 4.6 + * @stable ICU 4.6 + */ + UIDNA_ERROR_CONTEXTJ=0x1000, + /** + * A label does not meet the IDNA CONTEXTO requirements for punctuation characters. + * Some punctuation characters "Would otherwise have been DISALLOWED" + * but are allowed in certain contexts. (RFC 5892) + * @stable ICU 49 + */ + UIDNA_ERROR_CONTEXTO_PUNCTUATION=0x2000, + /** + * A label does not meet the IDNA CONTEXTO requirements for digits. + * Arabic-Indic Digits (U+066x) must not be mixed with Extended Arabic-Indic Digits (U+06Fx). + * @stable ICU 49 */ - UIDNA_ERROR_CONTEXTJ=0x1000 + UIDNA_ERROR_CONTEXTO_DIGITS=0x4000 }; /* IDNA2003 API ------------------------------------------------------------- */