]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/punycode.h
2 *******************************************************************************
4 * Copyright (C) 2002-2003, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
8 * file name: punycode.h
10 * tab size: 8 (not used)
13 * created on: 2002jan31
14 * created by: Markus W. Scherer
17 /* This ICU code derived from: */
19 punycode.c 0.4.0 (2001-Nov-17-Sat)
20 http://www.cs.berkeley.edu/~amc/idn/
22 http://www.nicemice.net/amc/
25 #ifndef __PUNYCODE_H__
26 #define __PUNYCODE_H__
28 #include "unicode/utypes.h"
33 * u_strToPunycode() converts Unicode to Punycode.
35 * The input string must not contain single, unpaired surrogates.
36 * The output will be represented as an array of ASCII code points.
38 * The output string is NUL-terminated according to normal ICU
39 * string output rules.
41 * @param src Input Unicode string.
42 * This function handles a limited amount of code points
43 * (the limit is >=64).
44 * U_INDEX_OUTOFBOUNDS_ERROR is set if the limit is exceeded.
45 * @param srcLength Number of UChars in src, or -1 if NUL-terminated.
46 * @param dest Output Punycode array.
47 * @param destCapacity Size of dest.
48 * @param caseFlags Vector of boolean values, one per input UChar,
49 * indicating that the corresponding character is to be
50 * marked for the decoder optionally
51 * uppercasing (TRUE) or lowercasing (FALSE)
53 * ASCII characters are output directly in the case as marked.
54 * Flags corresponding to trail surrogates are ignored.
55 * If caseFlags==NULL then input characters are not
57 * @param pErrorCode ICU in/out error code parameter.
58 * U_INVALID_CHAR_FOUND if src contains
59 * unmatched single surrogates.
60 * U_INDEX_OUTOFBOUNDS_ERROR if src contains
61 * too many code points.
62 * @return Number of ASCII characters in puny.
64 * @see u_strFromPunycode
67 u_strToPunycode(const UChar
*src
, int32_t srcLength
,
68 UChar
*dest
, int32_t destCapacity
,
69 const UBool
*caseFlags
,
70 UErrorCode
*pErrorCode
);
73 * u_strFromPunycode() converts Punycode to Unicode.
74 * The Unicode string will be at most as long (in UChars)
75 * than the Punycode string (in chars).
77 * @param src Input Punycode string.
78 * @param srcLength Length of puny, or -1 if NUL-terminated
79 * @param dest Output Unicode string buffer.
80 * @param destCapacity Size of dest in number of UChars,
81 * and of caseFlags in numbers of UBools.
82 * @param caseFlags Output array for case flags as
83 * defined by the Punycode string.
84 * The caller should uppercase (TRUE) or lowercase (FASLE)
85 * the corresponding character in dest.
86 * For supplementary characters, only the lead surrogate
87 * is marked, and FALSE is stored for the trail surrogate.
88 * This is redundant and not necessary for ASCII characters
89 * because they are already in the case indicated.
90 * Can be NULL if the case flags are not needed.
91 * @param pErrorCode ICU in/out error code parameter.
92 * U_INVALID_CHAR_FOUND if a non-ASCII character
93 * precedes the last delimiter ('-'),
94 * or if an invalid character (not a-zA-Z0-9) is found
95 * after the last delimiter.
96 * U_ILLEGAL_CHAR_FOUND if the delta sequence is ill-formed.
97 * @return Number of UChars written to dest.
99 * @see u_strToPunycode
102 u_strFromPunycode(const UChar
*src
, int32_t srcLength
,
103 UChar
*dest
, int32_t destCapacity
,
105 UErrorCode
*pErrorCode
);
107 #endif /* #if !UCONFIG_NO_IDNA */
112 * Hey, Emacs, please set the following:
115 * indent-tabs-mode: nil