sl@0: /* sl@0: ******************************************************************************* sl@0: * sl@0: * Copyright (C) 2002-2003, International Business Machines sl@0: * Corporation and others. All Rights Reserved. sl@0: * sl@0: ******************************************************************************* sl@0: * file name: punycode.h sl@0: * encoding: US-ASCII sl@0: * tab size: 8 (not used) sl@0: * indentation:4 sl@0: * sl@0: * created on: 2002jan31 sl@0: * created by: Markus W. Scherer sl@0: */ sl@0: sl@0: /* This ICU code derived from: */ sl@0: /* sl@0: punycode.c 0.4.0 (2001-Nov-17-Sat) sl@0: http://www.cs.berkeley.edu/~amc/idn/ sl@0: Adam M. Costello sl@0: http://www.nicemice.net/amc/ sl@0: */ sl@0: sl@0: #ifndef __PUNYCODE_H__ sl@0: #define __PUNYCODE_H__ sl@0: sl@0: #include "unicode/utypes.h" sl@0: sl@0: #if !UCONFIG_NO_IDNA sl@0: sl@0: /** sl@0: * u_strToPunycode() converts Unicode to Punycode. sl@0: * sl@0: * The input string must not contain single, unpaired surrogates. sl@0: * The output will be represented as an array of ASCII code points. sl@0: * sl@0: * The output string is NUL-terminated according to normal ICU sl@0: * string output rules. sl@0: * sl@0: * @param src Input Unicode string. sl@0: * This function handles a limited amount of code points sl@0: * (the limit is >=64). sl@0: * U_INDEX_OUTOFBOUNDS_ERROR is set if the limit is exceeded. sl@0: * @param srcLength Number of UChars in src, or -1 if NUL-terminated. sl@0: * @param dest Output Punycode array. sl@0: * @param destCapacity Size of dest. sl@0: * @param caseFlags Vector of boolean values, one per input UChar, sl@0: * indicating that the corresponding character is to be sl@0: * marked for the decoder optionally sl@0: * uppercasing (TRUE) or lowercasing (FALSE) sl@0: * the character. sl@0: * ASCII characters are output directly in the case as marked. sl@0: * Flags corresponding to trail surrogates are ignored. sl@0: * If caseFlags==NULL then input characters are not sl@0: * case-mapped. sl@0: * @param pErrorCode ICU in/out error code parameter. sl@0: * U_INVALID_CHAR_FOUND if src contains sl@0: * unmatched single surrogates. sl@0: * U_INDEX_OUTOFBOUNDS_ERROR if src contains sl@0: * too many code points. sl@0: * @return Number of ASCII characters in puny. sl@0: * sl@0: * @see u_strFromPunycode sl@0: */ sl@0: U_CFUNC int32_t sl@0: u_strToPunycode(const UChar *src, int32_t srcLength, sl@0: UChar *dest, int32_t destCapacity, sl@0: const UBool *caseFlags, sl@0: UErrorCode *pErrorCode); sl@0: sl@0: /** sl@0: * u_strFromPunycode() converts Punycode to Unicode. sl@0: * The Unicode string will be at most as long (in UChars) sl@0: * than the Punycode string (in chars). sl@0: * sl@0: * @param src Input Punycode string. sl@0: * @param srcLength Length of puny, or -1 if NUL-terminated sl@0: * @param dest Output Unicode string buffer. sl@0: * @param destCapacity Size of dest in number of UChars, sl@0: * and of caseFlags in numbers of UBools. sl@0: * @param caseFlags Output array for case flags as sl@0: * defined by the Punycode string. sl@0: * The caller should uppercase (TRUE) or lowercase (FASLE) sl@0: * the corresponding character in dest. sl@0: * For supplementary characters, only the lead surrogate sl@0: * is marked, and FALSE is stored for the trail surrogate. sl@0: * This is redundant and not necessary for ASCII characters sl@0: * because they are already in the case indicated. sl@0: * Can be NULL if the case flags are not needed. sl@0: * @param pErrorCode ICU in/out error code parameter. sl@0: * U_INVALID_CHAR_FOUND if a non-ASCII character sl@0: * precedes the last delimiter ('-'), sl@0: * or if an invalid character (not a-zA-Z0-9) is found sl@0: * after the last delimiter. sl@0: * U_ILLEGAL_CHAR_FOUND if the delta sequence is ill-formed. sl@0: * @return Number of UChars written to dest. sl@0: * sl@0: * @see u_strToPunycode sl@0: */ sl@0: U_CFUNC int32_t sl@0: u_strFromPunycode(const UChar *src, int32_t srcLength, sl@0: UChar *dest, int32_t destCapacity, sl@0: UBool *caseFlags, sl@0: UErrorCode *pErrorCode); sl@0: sl@0: #endif /* #if !UCONFIG_NO_IDNA */ sl@0: sl@0: #endif sl@0: sl@0: /* sl@0: * Hey, Emacs, please set the following: sl@0: * sl@0: * Local Variables: sl@0: * indent-tabs-mode: nil sl@0: * End: sl@0: * sl@0: */