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, un‐
35 flagged) suggests that it be forced to lowercase (if possi‐
36 ble). ASCII code points (0..7F) are encoded literally, ex‐
37 cept 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 Converts a sequence of code points (presumed to be Unicode code points)
63 to Punycode.
64
65 Return value: The return value can be any of the Punycode_status values
66 defined above except PUNYCODE_BAD_INPUT. If not PUNYCODE_SUCCESS, then
67 output_size and output might contain garbage.
68
70 Report bugs to <help-libidn@gnu.org>.
71 General guidelines for reporting bugs: http://www.gnu.org/gethelp/
72 GNU Libidn home page: http://www.gnu.org/software/libidn/
73
74
76 Copyright © 2002-2021 Simon Josefsson.
77 Copying and distribution of this file, with or without modification,
78 are permitted in any medium without royalty provided the copyright no‐
79 tice and this notice are preserved.
80
82 The full documentation for libidn is maintained as a Texinfo manual.
83 If the info and libidn programs are properly installed at your site,
84 the command
85
86 info libidn
87
88 should give you access to the complete manual. As an alternative you
89 may obtain the manual from:
90
91 http://www.gnu.org/software/libidn/manual/
92
93libidn 1.38 punycode_encode(3)