1b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* 2b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru******************************************************************************* 3c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert* Copyright (c) 1996-2015, International Business Machines Corporation 4b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* and others. All Rights Reserved. 5b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru******************************************************************************* 6b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* File unorm.h 7b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 8b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Created by: Vladimir Weinstein 12052000 9b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 10b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Modification history : 11b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 12b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Date Name Description 13b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 02/01/01 synwee Added normalization quickcheck enum and method. 14b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/ 15b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#ifndef UNORM_H 16b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define UNORM_H 17b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 18b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/utypes.h" 19b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 20b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#if !UCONFIG_NO_NORMALIZATION 21b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 22b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/uiter.h" 2350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#include "unicode/unorm2.h" 24b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 25c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert#ifndef U_HIDE_DEPRECATED_API 26c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert 27b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 28b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \file 29b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \brief C API: Unicode Normalization 30b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 31c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert * Old Unicode normalization API. 32b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 33c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert * This API has been replaced by the unorm2.h API and is only available 3450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * for backward compatibility. The functions here simply delegate to the 3550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * unorm2.h functions, for example unorm2_getInstance() and unorm2_normalize(). 3650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * There is one exception: The new API does not provide a replacement for unorm_compare(). 37c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert * Its declaration has been moved to unorm2.h. 3850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 39b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <code>unorm_normalize</code> transforms Unicode text into an equivalent composed or 40b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * decomposed form, allowing for easier sorting and searching of text. 41b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <code>unorm_normalize</code> supports the standard normalization forms described in 42b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <a href="http://www.unicode.org/unicode/reports/tr15/" target="unicode"> 43b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Unicode Standard Annex #15: Unicode Normalization Forms</a>. 44b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 45b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Characters with accents or other adornments can be encoded in 46b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * several different ways in Unicode. For example, take the character A-acute. 47b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * In Unicode, this can be encoded as a single character (the 48b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * "composed" form): 49b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 50b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \code 51b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 00C1 LATIN CAPITAL LETTER A WITH ACUTE 52b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \endcode 53b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 54b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or as two separate characters (the "decomposed" form): 55b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 56b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \code 57b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 0041 LATIN CAPITAL LETTER A 58b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 0301 COMBINING ACUTE ACCENT 59b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \endcode 60b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 61b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * To a user of your program, however, both of these sequences should be 62b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * treated as the same "user-level" character "A with acute accent". When you are searching or 63b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * comparing text, you must ensure that these two sequences are treated 64b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * equivalently. In addition, you must handle characters with more than one 65b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * accent. Sometimes the order of a character's combining accents is 66b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * significant, while in other cases accent sequences in different orders are 67b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * really equivalent. 68b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 69b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Similarly, the string "ffi" can be encoded as three separate letters: 70b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 71b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \code 72b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 0066 LATIN SMALL LETTER F 73b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 0066 LATIN SMALL LETTER F 74b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 0069 LATIN SMALL LETTER I 75b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \endcode 76b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 77b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or as the single character 78b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 79b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \code 80b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * FB03 LATIN SMALL LIGATURE FFI 81b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \endcode 82b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 83b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The ffi ligature is not a distinct semantic character, and strictly speaking 84b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * it shouldn't be in Unicode at all, but it was included for compatibility 85b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * with existing character sets that already provided it. The Unicode standard 86b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * identifies such characters by giving them "compatibility" decompositions 87b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * into the corresponding semantic characters. When sorting and searching, you 88b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * will often want to use these mappings. 89b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 90b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <code>unorm_normalize</code> helps solve these problems by transforming text into the 91b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * canonical composed and decomposed forms as shown in the first example above. 92b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * In addition, you can have it perform compatibility decompositions so that 93b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * you can treat compatibility characters the same as their equivalents. 94b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Finally, <code>unorm_normalize</code> rearranges accents into the proper canonical 95b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * order, so that you do not have to worry about accent rearrangement on your 96b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * own. 97b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 98b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Form FCD, "Fast C or D", is also designed for collation. 99b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * It allows to work on strings that are not necessarily normalized 100b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * with an algorithm (like in collation) that works under "canonical closure", i.e., it treats precomposed 101b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * characters and their decomposed equivalents the same. 102b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 103b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * It is not a normalization form because it does not provide for uniqueness of representation. Multiple strings 104b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * may be canonically equivalent (their NFDs are identical) and may all conform to FCD without being identical 105b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * themselves. 106b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 107b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The form is defined such that the "raw decomposition", the recursive canonical decomposition of each character, 108b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * results in a string that is canonically ordered. This means that precomposed characters are allowed for as long 109b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * as their decompositions do not need canonical reordering. 110b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 111b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Its advantage for a process like collation is that all NFD and most NFC texts - and many unnormalized texts - 112b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * already conform to FCD and do not need to be normalized (NFD) for such a process. The FCD quick check will 113b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * return UNORM_YES for most strings in practice. 114b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 115b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * unorm_normalize(UNORM_FCD) may be implemented with UNORM_NFD. 116b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For more details on FCD see the collation design document: 118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm 119b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 120b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * ICU collation performs either NFD or FCD normalization automatically if normalization 121b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is turned on for the collator object. 122b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Beyond collation and string search, normalized strings may be useful for string equivalence comparisons, 123b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * transliteration/transcription, unique representations, etc. 124b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 125b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The W3C generally recommends to exchange texts in NFC. 126b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Note also that most legacy character encodings use only precomposed forms and often do not 127b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * encode any combining marks by themselves. For conversion to such character encodings the 128b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Unicode text needs to be normalized to NFC. 129b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For more usage examples, see the Unicode Standard Annex. 130b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 131b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 132c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert#ifndef U_HIDE_DEPRECATED_API 133b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 134b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Constants for normalization modes. 135c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert * @deprecated ICU 56 Use unorm2.h instead. 136b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 137b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef enum { 138c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert /** No decomposition/composition. @deprecated ICU 56 Use unorm2.h instead. */ 139b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNORM_NONE = 1, 140c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert /** Canonical decomposition. @deprecated ICU 56 Use unorm2.h instead. */ 141b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNORM_NFD = 2, 142c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert /** Compatibility decomposition. @deprecated ICU 56 Use unorm2.h instead. */ 143b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNORM_NFKD = 3, 144c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert /** Canonical decomposition followed by canonical composition. @deprecated ICU 56 Use unorm2.h instead. */ 145b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNORM_NFC = 4, 146c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert /** Default normalization. @deprecated ICU 56 Use unorm2.h instead. */ 147b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNORM_DEFAULT = UNORM_NFC, 148c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert /** Compatibility decomposition followed by canonical composition. @deprecated ICU 56 Use unorm2.h instead. */ 149b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNORM_NFKC =5, 150c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert /** "Fast C or D" form. @deprecated ICU 56 Use unorm2.h instead. */ 151b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNORM_FCD = 6, 152b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 153c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert /** One more than the highest normalization mode constant. @deprecated ICU 56 Use unorm2.h instead. */ 154b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNORM_MODE_COUNT 155b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} UNormalizationMode; 156c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert#endif /* U_HIDE_DEPRECATED_API */ 157b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 158b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 159b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Constants for options flags for normalization. 160b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Use 0 for default options, 161b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * including normalization according to the Unicode version 162b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * that is currently supported by ICU (see u_getUnicodeVersion). 163c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert * @deprecated ICU 56 Use unorm2.h instead. 164b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 165b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruenum { 166b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 167b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Options bit set value to select Unicode 3.2 normalization 168b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (except NormalizationCorrections). 169b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * At most one Unicode version can be selected at a time. 170c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert * @deprecated ICU 56 Use unorm2.h instead. 171b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 172b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNORM_UNICODE_3_2=0x20 173b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}; 174b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 175b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 176b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Lowest-order bit number of unorm_compare() options bits corresponding to 177b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * normalization options bits. 178b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 179b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The options parameter for unorm_compare() uses most bits for 180b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * itself and for various comparison and folding flags. 181b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The most significant bits, however, are shifted down and passed on 182b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to the normalization implementation. 183b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (That is, from unorm_compare(..., options, ...), 184b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * options>>UNORM_COMPARE_NORM_OPTIONS_SHIFT will be passed on to the 185b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * internal normalization functions.) 186b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 187b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see unorm_compare 188c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert * @deprecated ICU 56 Use unorm2.h instead. 189b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 190b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20 191b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 192b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 193b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Normalize a string. 194b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The string will be normalized according the specified normalization mode 195b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and options. 196b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The source and result buffers must not be the same, nor overlap. 197b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 198b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source The string to normalize. 199b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param sourceLength The length of source, or -1 if NUL-terminated. 200b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param mode The normalization mode; one of UNORM_NONE, 201b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UNORM_NFD, UNORM_NFC, UNORM_NFKC, UNORM_NFKD, UNORM_DEFAULT. 202b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options The normalization options, ORed together (0 for no options). 203b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param result A pointer to a buffer to receive the result string. 204b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The result string is NUL-terminated if possible. 205b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resultLength The maximum size of result. 206b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status A pointer to a UErrorCode to receive any errors. 207b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The total buffer size needed; if greater than resultLength, 208b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the output was truncated, and the error code is set to U_BUFFER_OVERFLOW_ERROR. 209c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert * @deprecated ICU 56 Use unorm2.h instead. 210b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 211b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 212b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruunorm_normalize(const UChar *source, int32_t sourceLength, 213b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNormalizationMode mode, int32_t options, 214b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar *result, int32_t resultLength, 215b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 21650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 217b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 218b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Performing quick check on a string, to quickly determine if the string is 219b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * in a particular normalization format. 220b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Three types of result can be returned UNORM_YES, UNORM_NO or 221b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UNORM_MAYBE. Result UNORM_YES indicates that the argument 222b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * string is in the desired normalized format, UNORM_NO determines that 223b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * argument string is not in the desired normalized format. A 224b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UNORM_MAYBE result indicates that a more thorough check is required, 225b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the user may have to put the string in its normalized form and compare the 226b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * results. 227b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 228b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source string for determining if it is in a normalized format 229b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param sourcelength length of source to test, or -1 if NUL-terminated 230b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param mode which normalization form to test for 231b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status a pointer to a UErrorCode to receive any errors 232b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return UNORM_YES, UNORM_NO or UNORM_MAYBE 233b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 234b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see unorm_isNormalized 235c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert * @deprecated ICU 56 Use unorm2.h instead. 236b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 237b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UNormalizationCheckResult U_EXPORT2 238b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruunorm_quickCheck(const UChar *source, int32_t sourcelength, 239b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNormalizationMode mode, 240b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 241b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 242b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 243b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Performing quick check on a string; same as unorm_quickCheck but 244b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * takes an extra options parameter like most normalization functions. 245b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 246b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src String that is to be tested if it is in a normalization format. 247b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength Length of source to test, or -1 if NUL-terminated. 248b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param mode Which normalization form to test for. 249b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options The normalization options, ORed together (0 for no options). 250b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode ICU error code in/out parameter. 251b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Must fulfill U_SUCCESS before the function call. 252b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return UNORM_YES, UNORM_NO or UNORM_MAYBE 253b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 254b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see unorm_quickCheck 255b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see unorm_isNormalized 256c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert * @deprecated ICU 56 Use unorm2.h instead. 257b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 258b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UNormalizationCheckResult U_EXPORT2 259b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruunorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, 260b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNormalizationMode mode, int32_t options, 261b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 262b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 263b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 264b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Test if a string is in a given normalization form. 265b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This is semantically equivalent to source.equals(normalize(source, mode)) . 266b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 267b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Unlike unorm_quickCheck(), this function returns a definitive result, 268b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * never a "maybe". 269b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For NFD, NFKD, and FCD, both functions work exactly the same. 270b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For NFC and NFKC where quickCheck may return "maybe", this function will 271b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * perform further tests to arrive at a TRUE/FALSE result. 272b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 273b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src String that is to be tested if it is in a normalization format. 274b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength Length of source to test, or -1 if NUL-terminated. 275b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param mode Which normalization form to test for. 276b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode ICU error code in/out parameter. 277b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Must fulfill U_SUCCESS before the function call. 278b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return Boolean value indicating whether the source string is in the 279b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * "mode" normalization form. 280b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 281b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see unorm_quickCheck 282c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert * @deprecated ICU 56 Use unorm2.h instead. 283b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 284b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UBool U_EXPORT2 285b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruunorm_isNormalized(const UChar *src, int32_t srcLength, 286b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNormalizationMode mode, 287b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 288b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 289b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 290b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Test if a string is in a given normalization form; same as unorm_isNormalized but 291b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * takes an extra options parameter like most normalization functions. 292b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 293b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src String that is to be tested if it is in a normalization format. 294b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param srcLength Length of source to test, or -1 if NUL-terminated. 295b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param mode Which normalization form to test for. 296b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options The normalization options, ORed together (0 for no options). 297b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode ICU error code in/out parameter. 298b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Must fulfill U_SUCCESS before the function call. 299b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return Boolean value indicating whether the source string is in the 300b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * "mode/options" normalization form. 301b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 302b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see unorm_quickCheck 303b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see unorm_isNormalized 304c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert * @deprecated ICU 56 Use unorm2.h instead. 305b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 306b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UBool U_EXPORT2 307b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruunorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, 308b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNormalizationMode mode, int32_t options, 309b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 310b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 311b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 312b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Iterative normalization forward. 313b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This function (together with unorm_previous) is somewhat 314b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * similar to the C++ Normalizer class (see its non-static functions). 315b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 316b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Iterative normalization is useful when only a small portion of a longer 317b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * string/text needs to be processed. 318b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 319b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For example, the likelihood may be high that processing the first 10% of some 320b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * text will be sufficient to find certain data. 321b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Another example: When one wants to concatenate two normalized strings and get a 322b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * normalized result, it is much more efficient to normalize just a small part of 323b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the result around the concatenation place instead of re-normalizing everything. 324b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 325b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The input text is an instance of the C character iteration API UCharIterator. 326b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * It may wrap around a simple string, a CharacterIterator, a Replaceable, or any 327b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * other kind of text object. 328b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 329b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If a buffer overflow occurs, then the caller needs to reset the iterator to the 330b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * old index and call the function again with a larger buffer - if the caller cares 331b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for the actual output. 332b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Regardless of the output buffer, the iterator will always be moved to the next 333b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * normalization boundary. 334b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 335b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This function (like unorm_previous) serves two purposes: 336b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 337b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1) To find the next boundary so that the normalization of the part of the text 338b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * from the current position to that boundary does not affect and is not affected 339b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * by the part of the text beyond that boundary. 340b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 341b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 2) To normalize the text up to the boundary. 342b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 343b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The second step is optional, per the doNormalize parameter. 344b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * It is omitted for operations like string concatenation, where the two adjacent 345b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * string ends need to be normalized together. 346b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * In such a case, the output buffer will just contain a copy of the text up to the 347b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * boundary. 348b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 349b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pNeededToNormalize is an output-only parameter. Its output value is only defined 350b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if normalization was requested (doNormalize) and successful (especially, no 351b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * buffer overflow). 352b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * It is useful for operations like a normalizing transliterator, where one would 353b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * not want to replace a piece of text if it is not modified. 354b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 355b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If doNormalize==TRUE and pNeededToNormalize!=NULL then *pNeeded... is set TRUE 356b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if the normalization was necessary. 357b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 358b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If doNormalize==FALSE then *pNeededToNormalize will be set to FALSE. 359b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 360b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If the buffer overflows, then *pNeededToNormalize will be undefined; 361b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * essentially, whenever U_FAILURE is true (like in buffer overflows), this result 362b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * will be undefined. 363b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 364b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The input text in the form of a C character iterator. 365b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting. 366b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The number of UChars that fit into dest. 367b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param mode The normalization mode. 368b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options The normalization options, ORed together (0 for no options). 369b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param doNormalize Indicates if the source text up to the next boundary 370b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is to be normalized (TRUE) or just copied (FALSE). 371b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pNeededToNormalize Output flag indicating if the normalization resulted in 372b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * different text from the input. 373b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Not defined if an error occurs including buffer overflow. 374b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Always FALSE if !doNormalize. 375b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode ICU error code in/out parameter. 376b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Must fulfill U_SUCCESS before the function call. 377b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return Length of output (number of UChars) when successful or buffer overflow. 378b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 379b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see unorm_previous 380b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see unorm_normalize 381b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 382c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert * @deprecated ICU 56 Use unorm2.h instead. 383b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 384b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 385b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruunorm_next(UCharIterator *src, 386b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar *dest, int32_t destCapacity, 387b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNormalizationMode mode, int32_t options, 388b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UBool doNormalize, UBool *pNeededToNormalize, 389b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 390b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 391b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 392b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Iterative normalization backward. 393b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This function (together with unorm_next) is somewhat 394b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * similar to the C++ Normalizer class (see its non-static functions). 395b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For all details see unorm_next. 396b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 397b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param src The input text in the form of a C character iterator. 398b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting. 399b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The number of UChars that fit into dest. 400b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param mode The normalization mode. 401b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options The normalization options, ORed together (0 for no options). 402b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param doNormalize Indicates if the source text up to the next boundary 403b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is to be normalized (TRUE) or just copied (FALSE). 404b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pNeededToNormalize Output flag indicating if the normalization resulted in 405b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * different text from the input. 406b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Not defined if an error occurs including buffer overflow. 407b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Always FALSE if !doNormalize. 408b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode ICU error code in/out parameter. 409b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Must fulfill U_SUCCESS before the function call. 410b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return Length of output (number of UChars) when successful or buffer overflow. 411b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 412b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see unorm_next 413b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see unorm_normalize 414b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 415c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert * @deprecated ICU 56 Use unorm2.h instead. 416b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 417b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 418b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruunorm_previous(UCharIterator *src, 419b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar *dest, int32_t destCapacity, 420b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNormalizationMode mode, int32_t options, 421b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UBool doNormalize, UBool *pNeededToNormalize, 422b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 423b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 424b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 425b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Concatenate normalized strings, making sure that the result is normalized as well. 426b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 427b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If both the left and the right strings are in 428b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the normalization form according to "mode/options", 429b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * then the result will be 430b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 431b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \code 432b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest=normalize(left+right, mode, options) 433b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \endcode 434b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 435b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * With the input strings already being normalized, 436b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * this function will use unorm_next() and unorm_previous() 437b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to find the adjacent end pieces of the input strings. 438b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Only the concatenation of these end pieces will be normalized and 439b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * then concatenated with the remaining parts of the input strings. 440b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 441b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * It is allowed to have dest==left to avoid copying the entire left string. 442b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 443b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param left Left source string, may be same as dest. 444b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param leftLength Length of left source string, or -1 if NUL-terminated. 445b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param right Right source string. Must not be the same as dest, nor overlap. 446b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param rightLength Length of right source string, or -1 if NUL-terminated. 447b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting. 448b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The number of UChars that fit into dest. 449b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param mode The normalization mode. 450b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param options The normalization options, ORed together (0 for no options). 451b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pErrorCode ICU error code in/out parameter. 452b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Must fulfill U_SUCCESS before the function call. 453b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return Length of output (number of UChars) when successful or buffer overflow. 454b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 455b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see unorm_normalize 456b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see unorm_next 457b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see unorm_previous 458b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 459c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert * @deprecated ICU 56 Use unorm2.h instead. 460b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 461b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 462b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruunorm_concatenate(const UChar *left, int32_t leftLength, 463b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *right, int32_t rightLength, 464b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar *dest, int32_t destCapacity, 465b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UNormalizationMode mode, int32_t options, 466b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *pErrorCode); 467b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 468c14898b482f76ecab9026615e2e4c6fe78358bdcFredrik Roubert#endif /* U_HIDE_DEPRECATED_API */ 469b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_NORMALIZATION */ 470b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif 471