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