1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ******************************************************************************* 3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 4b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Copyright (C) 2003-2011, International Business Machines 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Corporation and others. All Rights Reserved. 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ******************************************************************************* 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * file name: idnaref.h 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * encoding: US-ASCII 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * tab size: 8 (not used) 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * indentation:4 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * created on: 2003feb1 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * created by: Ram Viswanadha 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef __IDNAREF_H__ 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define __IDNAREF_H__ 19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h" 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_IDNA 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/parseerr.h" 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define IDNAREF_DEFAULT 0x0000 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define IDNAREF_ALLOW_UNASSIGNED 0x0001 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define IDNAREF_USE_STD3_RULES 0x0002 29b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This function implements the ToASCII operation as defined in the IDNA draft. 32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This operation is done on <b>single labels</b> before sending it to something that expects 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ASCII names. A label is an individual part of a domain name. Labels are usually 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * separated by dots; for e.g." "www.example.com" is composed of 3 labels 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "www","example", and "com". 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param src Input Unicode label. 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param srcLength Number of UChars in src, or -1 if NUL-terminated. 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param dest Output Unicode array with ACE encoded ASCII label. 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param destCapacity Size of dest. 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param options A bit set of options: 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * - idnaref_UNASSIGNED Unassigned values can be converted to ASCII for query operations 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If TRUE unassigned values are treated as normal Unicode code points. 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If FALSE the operation fails with U_UNASSIGNED_CODE_POINT_FOUND error code. 47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * - idnaref_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If TRUE and the input does not statisfy STD3 rules, the operation 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * will fail with U_IDNA_STD3_ASCII_RULES_ERROR 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param parseError Pointer to UParseError struct to recieve information on position 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of error if an error is encountered. Can be NULL. 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status ICU in/out error code parameter. 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * U_INVALID_CHAR_FOUND if src contains 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * unmatched single surrogates. 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * U_INDEX_OUTOFBOUNDS_ERROR if src contains 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * too many code points. 58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Number of ASCII characters converted. 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_CFUNC int32_t U_EXPORT2 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruidnaref_toASCII(const UChar* src, int32_t srcLength, 63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UChar* dest, int32_t destCapacity, 64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t options, 65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UParseError* parseError, 66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode* status); 67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This function implements the ToUnicode operation as defined in the IDNA draft. 71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This operation is done on <b>single labels</b> before sending it to something that expects 72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ASCII names. A label is an individual part of a domain name. Labels are usually 73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * separated by dots; for e.g." "www.example.com" is composed of 3 labels 74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "www","example", and "com". 75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param src Input ASCII (ACE encoded) label. 77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param srcLength Number of UChars in src, or -1 if NUL-terminated. 78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param dest Output Converted Unicode array. 79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param destCapacity Size of dest. 80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param options A bit set of options: 81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * - idnaref_UNASSIGNED Unassigned values can be converted to ASCII for query operations 83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If TRUE unassigned values are treated as normal Unicode code points. 84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If FALSE the operation fails with U_UNASSIGNED_CODE_POINT_FOUND error code. 85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * - idnaref_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions 86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If TRUE and the input does not statisfy STD3 rules, the operation 87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * will fail with U_IDNA_STD3_ASCII_RULES_ERROR 88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param parseError Pointer to UParseError struct to recieve information on position 90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of error if an error is encountered. Can be NULL. 91ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status ICU in/out error code parameter. 92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * U_INVALID_CHAR_FOUND if src contains 93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * unmatched single surrogates. 94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * U_INDEX_OUTOFBOUNDS_ERROR if src contains 95ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * too many code points. 96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough 97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Number of Unicode characters converted. 98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_CFUNC int32_t U_EXPORT2 100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruidnaref_toUnicode(const UChar* src, int32_t srcLength, 101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UChar* dest, int32_t destCapacity, 102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t options, 103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UParseError* parseError, 104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode* status); 105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Convenience function that implements the IDNToASCII operation as defined in the IDNA draft. 109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This operation is done on complete domain names, e.g: "www.example.com". 110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * It is important to note that this operation can fail. If it fails, then the input 111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * domain name cannot be used as an Internationalized Domain Name and the application 112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * should have methods defined to deal with the failure. 113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <b>Note:</b> IDNA draft specifies that a conformant application should divide a domain name 115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, 116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and then convert. This function does not offer that level of granularity. The options once 117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * set will apply to all labels in the domain name 118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param src Input ASCII IDN. 120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param srcLength Number of UChars in src, or -1 if NUL-terminated. 121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param dest Output Unicode array. 122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param destCapacity Size of dest. 123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param options A bit set of options: 124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * - idnaref_UNASSIGNED Unassigned values can be converted to ASCII for query operations 126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If TRUE unassigned values are treated as normal Unicode code points. 127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If FALSE the operation fails with U_UNASSIGNED_CODE_POINT_FOUND error code. 128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * - idnaref_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions 129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If TRUE and the input does not statisfy STD3 rules, the operation 130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * will fail with U_IDNA_STD3_ASCII_RULES_ERROR 131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param parseError Pointer to UParseError struct to recieve information on position 133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of error if an error is encountered. Can be NULL. 134ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status ICU in/out error code parameter. 135ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * U_INVALID_CHAR_FOUND if src contains 136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * unmatched single surrogates. 137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * U_INDEX_OUTOFBOUNDS_ERROR if src contains 138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * too many code points. 139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough 140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Number of ASCII characters converted. 141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_CFUNC int32_t U_EXPORT2 143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruidnaref_IDNToASCII( const UChar* src, int32_t srcLength, 144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UChar* dest, int32_t destCapacity, 145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t options, 146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UParseError* parseError, 147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode* status); 148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Convenience function that implements the IDNToUnicode operation as defined in the IDNA draft. 151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This operation is done on complete domain names, e.g: "www.example.com". 152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <b>Note:</b> IDNA draft specifies that a conformant application should divide a domain name 154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, 155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and then convert. This function does not offer that level of granularity. The options once 156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * set will apply to all labels in the domain name 157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param src Input Unicode IDN. 159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param srcLength Number of UChars in src, or -1 if NUL-terminated. 160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param dest Output ASCII array. 161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param destCapacity Size of dest. 162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param options A bit set of options: 163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * - idnaref_UNASSIGNED Unassigned values can be converted to ASCII for query operations 165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If TRUE unassigned values are treated as normal Unicode code points. 166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If FALSE the operation fails with U_UNASSIGNED_CODE_POINT_FOUND error code. 167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * - idnaref_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions 168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If TRUE and the input does not statisfy STD3 rules, the operation 169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * will fail with U_IDNA_STD3_ASCII_RULES_ERROR 170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param parseError Pointer to UParseError struct to recieve information on position 172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of error if an error is encountered. Can be NULL. 173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status ICU in/out error code parameter. 174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * U_INVALID_CHAR_FOUND if src contains 175ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * unmatched single surrogates. 176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * U_INDEX_OUTOFBOUNDS_ERROR if src contains 177ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * too many code points. 178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough 179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Number of ASCII characters converted. 180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_CFUNC int32_t U_EXPORT2 182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruidnaref_IDNToUnicode( const UChar* src, int32_t srcLength, 183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UChar* dest, int32_t destCapacity, 184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t options, 185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UParseError* parseError, 186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode* status); 187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Compare two strings for IDNs for equivalence. 190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This function splits the domain names into labels and compares them. 191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * According to IDN draft, whenever two labels are compared, they are 192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * considered equal if and only if their ASCII forms (obtained by 193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * applying toASCII) match using an case-insensitive ASCII comparison. 194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Two domain names are considered a match if and only if all labels 195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * match regardless of whether label separators match. 196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param s1 First source string. 198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param length1 Length of first source string, or -1 if NUL-terminated. 199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param s2 Second source string. 201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param length2 Length of second source string, or -1 if NUL-terminated. 202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param options A bit set of options: 203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * - idnaref_UNASSIGNED Unassigned values can be converted to ASCII for query operations 205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If TRUE unassigned values are treated as normal Unicode code points. 206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If FALSE the operation fails with U_UNASSIGNED_CODE_POINT_FOUND error code. 207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * - idnaref_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions 208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If TRUE and the input does not statisfy STD3 rules, the operation 209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * will fail with U_IDNA_STD3_ASCII_RULES_ERROR 210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status ICU error code in/out parameter. 212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Must fulfill U_SUCCESS before the function call. 213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return <0 or 0 or >0 as usual for string comparisons 214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_CFUNC int32_t U_EXPORT2 216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruidnaref_compare( const UChar *s1, int32_t length1, 217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UChar *s2, int32_t length2, 218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t options, 219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode* status); 220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_IDNA */ 222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif 224