1punycode_encode(3) libidn punycode_encode(3)
2
3
4
6 punycode_encode - API function
7
9 #include <punycode.h>
10
11 int punycode_encode(size_t input_length, const punycode_uint [] input,
12 const unsigned char [] case_flags, size_t * output_length, char [] out‐
13 put);
14
16 size_t input_length
17 The number of code points in the input array and the num‐
18 ber of flags in the case_flags array.
19
20 const punycode_uint [] input
21 An array of code points. They are presumed to be Unicode
22 code points, but that is not strictly REQUIRED. The array
23 contains code points, not code units. UTF-16 uses code
24 units D800 through DFFF to refer to code points
25 10000..10FFFF. The code points D800..DFFF do not occur in
26 any valid Unicode string. The code points that can occur
27 in Unicode strings (0..D7FF and E000..10FFFF) are also
28 called Unicode scalar values.
29
30 const unsigned char [] case_flags
31 A NULL pointer or an array of boolean values parallel to
32 the input array. Nonzero (true, flagged) suggests that
33 the corresponding Unicode character be forced to uppercase
34 after being decoded (if possible), and zero (false,
35 unflagged) suggests that it be forced to lowercase (if pos‐
36 sible). ASCII code points (0..7F) are encoded literally,
37 except that ASCII letters are forced to uppercase or lower‐
38 case according to the corresponding case flags. If
39 case_flags is a NULL pointer then ASCII letters are left as
40 they are, and other code points are treated as unflagged.
41
42 size_t * output_length
43 The caller passes in the maximum number of ASCII code
44 points that it can receive. On successful return it will
45 contain the number of ASCII code points actually output.
46
47 char [] output
48 An array of ASCII code points. It is *not* null-termi‐
49 nated; it will contain zeros if and only if the input con‐
50 tains zeros. (Of course the caller can leave room for a
51 terminator and add one if needed.)
52
54 Converts a sequence of code points (presumed to be Unicode code points)
55 to Punycode.
56
57 Return value: The return value can be any of the Punycode_status values
58 defined above except PUNYCODE_BAD_INPUT. If not PUNYCODE_SUCCESS, then
59 output_size and output might contain garbage.
60
62 Report bugs to <bug-libidn@gnu.org>.
63 General guidelines for reporting bugs: http://www.gnu.org/gethelp/
64 GNU Libidn home page: http://www.gnu.org/software/libidn/
65
66
68 Copyright © 2002-2020 Simon Josefsson.
69 Copying and distribution of this file, with or without modification,
70 are permitted in any medium without royalty provided the copyright
71 notice and this notice are preserved.
72
74 The full documentation for libidn is maintained as a Texinfo manual.
75 If the info and libidn programs are properly installed at your site,
76 the command
77
78 info libidn
79
80 should give you access to the complete manual. As an alternative you
81 may obtain the manual from:
82
83 http://www.gnu.org/software/libidn/manual/
84
85libidn 1.36 punycode_encode(3)