sl@0: /* sl@0: ******************************************************************************* sl@0: * Copyright (c) 1996-2005, International Business Machines Corporation sl@0: * and others. All Rights Reserved. sl@0: ******************************************************************************* sl@0: * File unorm.h sl@0: * sl@0: * Created by: Vladimir Weinstein 12052000 sl@0: * sl@0: * Modification history : sl@0: * sl@0: * Date Name Description sl@0: * 02/01/01 synwee Added normalization quickcheck enum and method. sl@0: */ sl@0: #ifndef UNORM_H sl@0: #define UNORM_H sl@0: sl@0: #include "unicode/utypes.h" sl@0: sl@0: #if !UCONFIG_NO_NORMALIZATION sl@0: sl@0: #include "unicode/uiter.h" sl@0: sl@0: /** sl@0: * \file sl@0: * \brief C API: Unicode Normalization sl@0: * sl@0: *
unorm_normalize
transforms Unicode text into an equivalent composed or
sl@0: * decomposed form, allowing for easier sorting and searching of text.
sl@0: * unorm_normalize
supports the standard normalization forms described in
sl@0: *
sl@0: * Unicode Standard Annex #15: Unicode Normalization Forms.
sl@0: *
sl@0: * Characters with accents or other adornments can be encoded in
sl@0: * several different ways in Unicode. For example, take the character A-acute.
sl@0: * In Unicode, this can be encoded as a single character (the
sl@0: * "composed" form):
sl@0: *
sl@0: * \code
sl@0: * 00C1 LATIN CAPITAL LETTER A WITH ACUTE
sl@0: * \endcode
sl@0: *
sl@0: * or as two separate characters (the "decomposed" form):
sl@0: *
sl@0: * \code
sl@0: * 0041 LATIN CAPITAL LETTER A
sl@0: * 0301 COMBINING ACUTE ACCENT
sl@0: * \endcode
sl@0: *
sl@0: * To a user of your program, however, both of these sequences should be
sl@0: * treated as the same "user-level" character "A with acute accent". When you are searching or
sl@0: * comparing text, you must ensure that these two sequences are treated
sl@0: * equivalently. In addition, you must handle characters with more than one
sl@0: * accent. Sometimes the order of a character's combining accents is
sl@0: * significant, while in other cases accent sequences in different orders are
sl@0: * really equivalent.
sl@0: *
sl@0: * Similarly, the string "ffi" can be encoded as three separate letters:
sl@0: *
sl@0: * \code
sl@0: * 0066 LATIN SMALL LETTER F
sl@0: * 0066 LATIN SMALL LETTER F
sl@0: * 0069 LATIN SMALL LETTER I
sl@0: * \endcode
sl@0: *
sl@0: * or as the single character
sl@0: *
sl@0: * \code
sl@0: * FB03 LATIN SMALL LIGATURE FFI
sl@0: * \endcode
sl@0: *
sl@0: * The ffi ligature is not a distinct semantic character, and strictly speaking
sl@0: * it shouldn't be in Unicode at all, but it was included for compatibility
sl@0: * with existing character sets that already provided it. The Unicode standard
sl@0: * identifies such characters by giving them "compatibility" decompositions
sl@0: * into the corresponding semantic characters. When sorting and searching, you
sl@0: * will often want to use these mappings.
sl@0: *
sl@0: * unorm_normalize
helps solve these problems by transforming text into the
sl@0: * canonical composed and decomposed forms as shown in the first example above.
sl@0: * In addition, you can have it perform compatibility decompositions so that
sl@0: * you can treat compatibility characters the same as their equivalents.
sl@0: * Finally, unorm_normalize
rearranges accents into the proper canonical
sl@0: * order, so that you do not have to worry about accent rearrangement on your
sl@0: * own.
sl@0: *
sl@0: * Form FCD, "Fast C or D", is also designed for collation.
sl@0: * It allows to work on strings that are not necessarily normalized
sl@0: * with an algorithm (like in collation) that works under "canonical closure", i.e., it treats precomposed
sl@0: * characters and their decomposed equivalents the same.
sl@0: *
sl@0: * It is not a normalization form because it does not provide for uniqueness of representation. Multiple strings
sl@0: * may be canonically equivalent (their NFDs are identical) and may all conform to FCD without being identical
sl@0: * themselves.
sl@0: *
sl@0: * The form is defined such that the "raw decomposition", the recursive canonical decomposition of each character,
sl@0: * results in a string that is canonically ordered. This means that precomposed characters are allowed for as long
sl@0: * as their decompositions do not need canonical reordering.
sl@0: *
sl@0: * Its advantage for a process like collation is that all NFD and most NFC texts - and many unnormalized texts -
sl@0: * already conform to FCD and do not need to be normalized (NFD) for such a process. The FCD quick check will
sl@0: * return UNORM_YES for most strings in practice.
sl@0: *
sl@0: * unorm_normalize(UNORM_FCD) may be implemented with UNORM_NFD.
sl@0: *
sl@0: * For more details on FCD see the collation design document:
sl@0: * http://dev.icu-project.org/cgi-bin/viewcvs.cgi/~checkout~/icuhtml/design/collation/ICU_collation_design.htm
sl@0: *
sl@0: * ICU collation performs either NFD or FCD normalization automatically if normalization
sl@0: * is turned on for the collator object.
sl@0: * Beyond collation and string search, normalized strings may be useful for string equivalence comparisons,
sl@0: * transliteration/transcription, unique representations, etc.
sl@0: *
sl@0: * The W3C generally recommends to exchange texts in NFC.
sl@0: * Note also that most legacy character encodings use only precomposed forms and often do not
sl@0: * encode any combining marks by themselves. For conversion to such character encodings the
sl@0: * Unicode text needs to be normalized to NFC.
sl@0: * For more usage examples, see the Unicode Standard Annex.
sl@0: */
sl@0:
sl@0: /**
sl@0: * Constants for normalization modes.
sl@0: * @stable ICU 2.0
sl@0: */
sl@0: typedef enum {
sl@0: /** No decomposition/composition. @stable ICU 2.0 */
sl@0: UNORM_NONE = 1,
sl@0: /** Canonical decomposition. @stable ICU 2.0 */
sl@0: UNORM_NFD = 2,
sl@0: /** Compatibility decomposition. @stable ICU 2.0 */
sl@0: UNORM_NFKD = 3,
sl@0: /** Canonical decomposition followed by canonical composition. @stable ICU 2.0 */
sl@0: UNORM_NFC = 4,
sl@0: /** Default normalization. @stable ICU 2.0 */
sl@0: UNORM_DEFAULT = UNORM_NFC,
sl@0: /** Compatibility decomposition followed by canonical composition. @stable ICU 2.0 */
sl@0: UNORM_NFKC =5,
sl@0: /** "Fast C or D" form. @stable ICU 2.0 */
sl@0: UNORM_FCD = 6,
sl@0:
sl@0: /** One more than the highest normalization mode constant. @stable ICU 2.0 */
sl@0: UNORM_MODE_COUNT
sl@0: } UNormalizationMode;
sl@0:
sl@0: /**
sl@0: * Constants for options flags for normalization.
sl@0: * Use 0 for default options,
sl@0: * including normalization according to the Unicode version
sl@0: * that is currently supported by ICU (see u_getUnicodeVersion).
sl@0: * @stable ICU 2.6
sl@0: */
sl@0: enum {
sl@0: /**
sl@0: * Options bit set value to select Unicode 3.2 normalization
sl@0: * (except NormalizationCorrections).
sl@0: * At most one Unicode version can be selected at a time.
sl@0: * @stable ICU 2.6
sl@0: */
sl@0: UNORM_UNICODE_3_2=0x20
sl@0: };
sl@0:
sl@0: /**
sl@0: * Lowest-order bit number of unorm_compare() options bits corresponding to
sl@0: * normalization options bits.
sl@0: *
sl@0: * The options parameter for unorm_compare() uses most bits for
sl@0: * itself and for various comparison and folding flags.
sl@0: * The most significant bits, however, are shifted down and passed on
sl@0: * to the normalization implementation.
sl@0: * (That is, from unorm_compare(..., options, ...),
sl@0: * options>>UNORM_COMPARE_NORM_OPTIONS_SHIFT will be passed on to the
sl@0: * internal normalization functions.)
sl@0: *
sl@0: * @see unorm_compare
sl@0: * @stable ICU 2.6
sl@0: */
sl@0: #define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20
sl@0:
sl@0: /**
sl@0: * Normalize a string.
sl@0: * The string will be normalized according the specified normalization mode
sl@0: * and options.
sl@0: *
sl@0: * @param source The string to normalize.
sl@0: * @param sourceLength The length of source, or -1 if NUL-terminated.
sl@0: * @param mode The normalization mode; one of UNORM_NONE,
sl@0: * UNORM_NFD, UNORM_NFC, UNORM_NFKC, UNORM_NFKD, UNORM_DEFAULT.
sl@0: * @param options The normalization options, ORed together (0 for no options).
sl@0: * @param result A pointer to a buffer to receive the result string.
sl@0: * The result string is NUL-terminated if possible.
sl@0: * @param resultLength The maximum size of result.
sl@0: * @param status A pointer to a UErrorCode to receive any errors.
sl@0: * @return The total buffer size needed; if greater than resultLength,
sl@0: * the output was truncated, and the error code is set to U_BUFFER_OVERFLOW_ERROR.
sl@0: * @stable ICU 2.0
sl@0: */
sl@0: U_STABLE int32_t U_EXPORT2
sl@0: unorm_normalize(const UChar *source, int32_t sourceLength,
sl@0: UNormalizationMode mode, int32_t options,
sl@0: UChar *result, int32_t resultLength,
sl@0: UErrorCode *status);
sl@0: #endif
sl@0: /**
sl@0: * Result values for unorm_quickCheck().
sl@0: * For details see Unicode Technical Report 15.
sl@0: * @stable ICU 2.0
sl@0: */
sl@0: typedef enum UNormalizationCheckResult {
sl@0: /**
sl@0: * Indicates that string is not in the normalized format
sl@0: */
sl@0: UNORM_NO,
sl@0: /**
sl@0: * Indicates that string is in the normalized format
sl@0: */
sl@0: UNORM_YES,
sl@0: /**
sl@0: * Indicates that string cannot be determined if it is in the normalized
sl@0: * format without further thorough checks.
sl@0: */
sl@0: UNORM_MAYBE
sl@0: } UNormalizationCheckResult;
sl@0: #if !UCONFIG_NO_NORMALIZATION
sl@0: /**
sl@0: * Performing quick check on a string, to quickly determine if the string is
sl@0: * in a particular normalization format.
sl@0: * Three types of result can be returned UNORM_YES, UNORM_NO or
sl@0: * UNORM_MAYBE. Result UNORM_YES indicates that the argument
sl@0: * string is in the desired normalized format, UNORM_NO determines that
sl@0: * argument string is not in the desired normalized format. A
sl@0: * UNORM_MAYBE result indicates that a more thorough check is required,
sl@0: * the user may have to put the string in its normalized form and compare the
sl@0: * results.
sl@0: *
sl@0: * @param source string for determining if it is in a normalized format
sl@0: * @param sourcelength length of source to test, or -1 if NUL-terminated
sl@0: * @param mode which normalization form to test for
sl@0: * @param status a pointer to a UErrorCode to receive any errors
sl@0: * @return UNORM_YES, UNORM_NO or UNORM_MAYBE
sl@0: *
sl@0: * @see unorm_isNormalized
sl@0: * @stable ICU 2.0
sl@0: */
sl@0: U_STABLE UNormalizationCheckResult U_EXPORT2
sl@0: unorm_quickCheck(const UChar *source, int32_t sourcelength,
sl@0: UNormalizationMode mode,
sl@0: UErrorCode *status);
sl@0:
sl@0: /**
sl@0: * Performing quick check on a string; same as unorm_quickCheck but
sl@0: * takes an extra options parameter like most normalization functions.
sl@0: *
sl@0: * @param src String that is to be tested if it is in a normalization format.
sl@0: * @param srcLength Length of source to test, or -1 if NUL-terminated.
sl@0: * @param mode Which normalization form to test for.
sl@0: * @param options The normalization options, ORed together (0 for no options).
sl@0: * @param pErrorCode ICU error code in/out parameter.
sl@0: * Must fulfill U_SUCCESS before the function call.
sl@0: * @return UNORM_YES, UNORM_NO or UNORM_MAYBE
sl@0: *
sl@0: * @see unorm_quickCheck
sl@0: * @see unorm_isNormalized
sl@0: * @stable ICU 2.6
sl@0: */
sl@0: U_STABLE UNormalizationCheckResult U_EXPORT2
sl@0: unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength,
sl@0: UNormalizationMode mode, int32_t options,
sl@0: UErrorCode *pErrorCode);
sl@0:
sl@0: /**
sl@0: * Test if a string is in a given normalization form.
sl@0: * This is semantically equivalent to source.equals(normalize(source, mode)) .
sl@0: *
sl@0: * Unlike unorm_quickCheck(), this function returns a definitive result,
sl@0: * never a "maybe".
sl@0: * For NFD, NFKD, and FCD, both functions work exactly the same.
sl@0: * For NFC and NFKC where quickCheck may return "maybe", this function will
sl@0: * perform further tests to arrive at a TRUE/FALSE result.
sl@0: *
sl@0: * @param src String that is to be tested if it is in a normalization format.
sl@0: * @param srcLength Length of source to test, or -1 if NUL-terminated.
sl@0: * @param mode Which normalization form to test for.
sl@0: * @param pErrorCode ICU error code in/out parameter.
sl@0: * Must fulfill U_SUCCESS before the function call.
sl@0: * @return Boolean value indicating whether the source string is in the
sl@0: * "mode" normalization form.
sl@0: *
sl@0: * @see unorm_quickCheck
sl@0: * @stable ICU 2.2
sl@0: */
sl@0: U_STABLE UBool U_EXPORT2
sl@0: unorm_isNormalized(const UChar *src, int32_t srcLength,
sl@0: UNormalizationMode mode,
sl@0: UErrorCode *pErrorCode);
sl@0:
sl@0: /**
sl@0: * Test if a string is in a given normalization form; same as unorm_isNormalized but
sl@0: * takes an extra options parameter like most normalization functions.
sl@0: *
sl@0: * @param src String that is to be tested if it is in a normalization format.
sl@0: * @param srcLength Length of source to test, or -1 if NUL-terminated.
sl@0: * @param mode Which normalization form to test for.
sl@0: * @param options The normalization options, ORed together (0 for no options).
sl@0: * @param pErrorCode ICU error code in/out parameter.
sl@0: * Must fulfill U_SUCCESS before the function call.
sl@0: * @return Boolean value indicating whether the source string is in the
sl@0: * "mode/options" normalization form.
sl@0: *
sl@0: * @see unorm_quickCheck
sl@0: * @see unorm_isNormalized
sl@0: * @stable ICU 2.6
sl@0: */
sl@0: U_STABLE UBool U_EXPORT2
sl@0: unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength,
sl@0: UNormalizationMode mode, int32_t options,
sl@0: UErrorCode *pErrorCode);
sl@0:
sl@0: /**
sl@0: * Iterative normalization forward.
sl@0: * This function (together with unorm_previous) is somewhat
sl@0: * similar to the C++ Normalizer class (see its non-static functions).
sl@0: *
sl@0: * Iterative normalization is useful when only a small portion of a longer
sl@0: * string/text needs to be processed.
sl@0: *
sl@0: * For example, the likelihood may be high that processing the first 10% of some
sl@0: * text will be sufficient to find certain data.
sl@0: * Another example: When one wants to concatenate two normalized strings and get a
sl@0: * normalized result, it is much more efficient to normalize just a small part of
sl@0: * the result around the concatenation place instead of re-normalizing everything.
sl@0: *
sl@0: * The input text is an instance of the C character iteration API UCharIterator.
sl@0: * It may wrap around a simple string, a CharacterIterator, a Replaceable, or any
sl@0: * other kind of text object.
sl@0: *
sl@0: * If a buffer overflow occurs, then the caller needs to reset the iterator to the
sl@0: * old index and call the function again with a larger buffer - if the caller cares
sl@0: * for the actual output.
sl@0: * Regardless of the output buffer, the iterator will always be moved to the next
sl@0: * normalization boundary.
sl@0: *
sl@0: * This function (like unorm_previous) serves two purposes:
sl@0: *
sl@0: * 1) To find the next boundary so that the normalization of the part of the text
sl@0: * from the current position to that boundary does not affect and is not affected
sl@0: * by the part of the text beyond that boundary.
sl@0: *
sl@0: * 2) To normalize the text up to the boundary.
sl@0: *
sl@0: * The second step is optional, per the doNormalize parameter.
sl@0: * It is omitted for operations like string concatenation, where the two adjacent
sl@0: * string ends need to be normalized together.
sl@0: * In such a case, the output buffer will just contain a copy of the text up to the
sl@0: * boundary.
sl@0: *
sl@0: * pNeededToNormalize is an output-only parameter. Its output value is only defined
sl@0: * if normalization was requested (doNormalize) and successful (especially, no
sl@0: * buffer overflow).
sl@0: * It is useful for operations like a normalizing transliterator, where one would
sl@0: * not want to replace a piece of text if it is not modified.
sl@0: *
sl@0: * If doNormalize==TRUE and pNeededToNormalize!=NULL then *pNeeded... is set TRUE
sl@0: * if the normalization was necessary.
sl@0: *
sl@0: * If doNormalize==FALSE then *pNeededToNormalize will be set to FALSE.
sl@0: *
sl@0: * If the buffer overflows, then *pNeededToNormalize will be undefined;
sl@0: * essentially, whenever U_FAILURE is true (like in buffer overflows), this result
sl@0: * will be undefined.
sl@0: *
sl@0: * @param src The input text in the form of a C character iterator.
sl@0: * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting.
sl@0: * @param destCapacity The number of UChars that fit into dest.
sl@0: * @param mode The normalization mode.
sl@0: * @param options The normalization options, ORed together (0 for no options).
sl@0: * @param doNormalize Indicates if the source text up to the next boundary
sl@0: * is to be normalized (TRUE) or just copied (FALSE).
sl@0: * @param pNeededToNormalize Output flag indicating if the normalization resulted in
sl@0: * different text from the input.
sl@0: * Not defined if an error occurs including buffer overflow.
sl@0: * Always FALSE if !doNormalize.
sl@0: * @param pErrorCode ICU error code in/out parameter.
sl@0: * Must fulfill U_SUCCESS before the function call.
sl@0: * @return Length of output (number of UChars) when successful or buffer overflow.
sl@0: *
sl@0: * @see unorm_previous
sl@0: * @see unorm_normalize
sl@0: *
sl@0: * @stable ICU 2.1
sl@0: */
sl@0: U_STABLE int32_t U_EXPORT2
sl@0: unorm_next(UCharIterator *src,
sl@0: UChar *dest, int32_t destCapacity,
sl@0: UNormalizationMode mode, int32_t options,
sl@0: UBool doNormalize, UBool *pNeededToNormalize,
sl@0: UErrorCode *pErrorCode);
sl@0:
sl@0: /**
sl@0: * Iterative normalization backward.
sl@0: * This function (together with unorm_next) is somewhat
sl@0: * similar to the C++ Normalizer class (see its non-static functions).
sl@0: * For all details see unorm_next.
sl@0: *
sl@0: * @param src The input text in the form of a C character iterator.
sl@0: * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting.
sl@0: * @param destCapacity The number of UChars that fit into dest.
sl@0: * @param mode The normalization mode.
sl@0: * @param options The normalization options, ORed together (0 for no options).
sl@0: * @param doNormalize Indicates if the source text up to the next boundary
sl@0: * is to be normalized (TRUE) or just copied (FALSE).
sl@0: * @param pNeededToNormalize Output flag indicating if the normalization resulted in
sl@0: * different text from the input.
sl@0: * Not defined if an error occurs including buffer overflow.
sl@0: * Always FALSE if !doNormalize.
sl@0: * @param pErrorCode ICU error code in/out parameter.
sl@0: * Must fulfill U_SUCCESS before the function call.
sl@0: * @return Length of output (number of UChars) when successful or buffer overflow.
sl@0: *
sl@0: * @see unorm_next
sl@0: * @see unorm_normalize
sl@0: *
sl@0: * @stable ICU 2.1
sl@0: */
sl@0: U_STABLE int32_t U_EXPORT2
sl@0: unorm_previous(UCharIterator *src,
sl@0: UChar *dest, int32_t destCapacity,
sl@0: UNormalizationMode mode, int32_t options,
sl@0: UBool doNormalize, UBool *pNeededToNormalize,
sl@0: UErrorCode *pErrorCode);
sl@0:
sl@0: /**
sl@0: * Concatenate normalized strings, making sure that the result is normalized as well.
sl@0: *
sl@0: * If both the left and the right strings are in
sl@0: * the normalization form according to "mode/options",
sl@0: * then the result will be
sl@0: *
sl@0: * \code
sl@0: * dest=normalize(left+right, mode, options)
sl@0: * \endcode
sl@0: *
sl@0: * With the input strings already being normalized,
sl@0: * this function will use unorm_next() and unorm_previous()
sl@0: * to find the adjacent end pieces of the input strings.
sl@0: * Only the concatenation of these end pieces will be normalized and
sl@0: * then concatenated with the remaining parts of the input strings.
sl@0: *
sl@0: * It is allowed to have dest==left to avoid copying the entire left string.
sl@0: *
sl@0: * @param left Left source string, may be same as dest.
sl@0: * @param leftLength Length of left source string, or -1 if NUL-terminated.
sl@0: * @param right Right source string.
sl@0: * @param rightLength Length of right source string, or -1 if NUL-terminated.
sl@0: * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting.
sl@0: * @param destCapacity The number of UChars that fit into dest.
sl@0: * @param mode The normalization mode.
sl@0: * @param options The normalization options, ORed together (0 for no options).
sl@0: * @param pErrorCode ICU error code in/out parameter.
sl@0: * Must fulfill U_SUCCESS before the function call.
sl@0: * @return Length of output (number of UChars) when successful or buffer overflow.
sl@0: *
sl@0: * @see unorm_normalize
sl@0: * @see unorm_next
sl@0: * @see unorm_previous
sl@0: *
sl@0: * @stable ICU 2.1
sl@0: */
sl@0: U_STABLE int32_t U_EXPORT2
sl@0: unorm_concatenate(const UChar *left, int32_t leftLength,
sl@0: const UChar *right, int32_t rightLength,
sl@0: UChar *dest, int32_t destCapacity,
sl@0: UNormalizationMode mode, int32_t options,
sl@0: UErrorCode *pErrorCode);
sl@0:
sl@0: /**
sl@0: * Option bit for unorm_compare:
sl@0: * Both input strings are assumed to fulfill FCD conditions.
sl@0: * @stable ICU 2.2
sl@0: */
sl@0: #define UNORM_INPUT_IS_FCD 0x20000
sl@0:
sl@0: /**
sl@0: * Option bit for unorm_compare:
sl@0: * Perform case-insensitive comparison.
sl@0: * @stable ICU 2.2
sl@0: */
sl@0: #define U_COMPARE_IGNORE_CASE 0x10000
sl@0:
sl@0: #ifndef U_COMPARE_CODE_POINT_ORDER
sl@0: /* see also unistr.h and ustring.h */
sl@0: /**
sl@0: * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc:
sl@0: * Compare strings in code point order instead of code unit order.
sl@0: * @stable ICU 2.2
sl@0: */
sl@0: #define U_COMPARE_CODE_POINT_ORDER 0x8000
sl@0: #endif
sl@0:
sl@0: /**
sl@0: * Compare two strings for canonical equivalence.
sl@0: * Further options include case-insensitive comparison and
sl@0: * code point order (as opposed to code unit order).
sl@0: *
sl@0: * Canonical equivalence between two strings is defined as their normalized
sl@0: * forms (NFD or NFC) being identical.
sl@0: * This function compares strings incrementally instead of normalizing
sl@0: * (and optionally case-folding) both strings entirely,
sl@0: * improving performance significantly.
sl@0: *
sl@0: * Bulk normalization is only necessary if the strings do not fulfill the FCD
sl@0: * conditions. Only in this case, and only if the strings are relatively long,
sl@0: * is memory allocated temporarily.
sl@0: * For FCD strings and short non-FCD strings there is no memory allocation.
sl@0: *
sl@0: * Semantically, this is equivalent to
sl@0: * strcmp[CodePointOrder](NFD(foldCase(NFD(s1))), NFD(foldCase(NFD(s2))))
sl@0: * where code point order and foldCase are all optional.
sl@0: *
sl@0: * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match
sl@0: * the case folding must be performed first, then the normalization.
sl@0: *
sl@0: * @param s1 First source string.
sl@0: * @param length1 Length of first source string, or -1 if NUL-terminated.
sl@0: *
sl@0: * @param s2 Second source string.
sl@0: * @param length2 Length of second source string, or -1 if NUL-terminated.
sl@0: *
sl@0: * @param options A bit set of options:
sl@0: * - U_FOLD_CASE_DEFAULT or 0 is used for default options:
sl@0: * Case-sensitive comparison in code unit order, and the input strings
sl@0: * are quick-checked for FCD.
sl@0: *
sl@0: * - UNORM_INPUT_IS_FCD
sl@0: * Set if the caller knows that both s1 and s2 fulfill the FCD conditions.
sl@0: * If not set, the function will quickCheck for FCD
sl@0: * and normalize if necessary.
sl@0: *
sl@0: * - U_COMPARE_CODE_POINT_ORDER
sl@0: * Set to choose code point order instead of code unit order
sl@0: * (see u_strCompare for details).
sl@0: *
sl@0: * - U_COMPARE_IGNORE_CASE
sl@0: * Set to compare strings case-insensitively using case folding,
sl@0: * instead of case-sensitively.
sl@0: * If set, then the following case folding options are used.
sl@0: *
sl@0: * - Options as used with case-insensitive comparisons, currently:
sl@0: *
sl@0: * - U_FOLD_CASE_EXCLUDE_SPECIAL_I
sl@0: * (see u_strCaseCompare for details)
sl@0: *
sl@0: * - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT
sl@0: *
sl@0: * @param pErrorCode ICU error code in/out parameter.
sl@0: * Must fulfill U_SUCCESS before the function call.
sl@0: * @return <0 or 0 or >0 as usual for string comparisons
sl@0: *
sl@0: * @see unorm_normalize
sl@0: * @see UNORM_FCD
sl@0: * @see u_strCompare
sl@0: * @see u_strCaseCompare
sl@0: *
sl@0: * @stable ICU 2.2
sl@0: */
sl@0: U_STABLE int32_t U_EXPORT2
sl@0: unorm_compare(const UChar *s1, int32_t length1,
sl@0: const UChar *s2, int32_t length2,
sl@0: uint32_t options,
sl@0: UErrorCode *pErrorCode);
sl@0:
sl@0: #endif /* #if !UCONFIG_NO_NORMALIZATION */
sl@0:
sl@0: #endif