1stringprep(n) Preparation of Internationalized Strings stringprep(n)
2
3
4
5______________________________________________________________________________
6
8 stringprep - Implementation of stringprep
9
11 package require Tcl 8.3
12
13 package require stringprep 1.0.1
14
15 ::stringprep::register profile ?-mapping list? ?-normalization form?
16 ?-prohibited list? ?-prohibitedList list? ?-prohibitedCommand command?
17 ?-prohibitedBidi boolean?
18
19 ::stringprep::stringprep profile string
20
21 ::stringprep::compare profile string1 string2
22
23______________________________________________________________________________
24
26 This is an implementation in Tcl of the Preparation of International‐
27 ized Strings ("stringprep"). It allows to define stringprep profiles
28 and use them to prepare Unicode strings for comparison as defined in
29 RFC-3454.
30
32 ::stringprep::register profile ?-mapping list? ?-normalization form?
33 ?-prohibited list? ?-prohibitedList list? ?-prohibitedCommand command?
34 ?-prohibitedBidi boolean?
35 Register the stringprep profile named profile. Options are the
36 following.
37
38 Option -mapping specifies stringprep mapping tables. This
39 parameter takes list of tables from appendix B of RFC-3454. The
40 usual list values are {B.1 B.2} or {B.1 B.3} where B.1 contains
41 characters which commonly map to nothing, B.3 specifies case
42 folding, and B.2 is used in profiles with unicode normalization
43 form KC. Defult value is {} which means no mapping.
44
45 Option -normalization takes a string and if it is nonempty then
46 it uses as a name of Unicode normalization form. Any value of
47 "D", "C", "KD" or "KC" may be used, though RFC-3454 defines only
48 two options: no normalization or normalization using form KC.
49
50 Option -prohibited takes a list of RFC-3454 tables with prohib‐
51 ited characters. Current version does allow to prohibit either
52 all tables from C.3 to C.9 or neither of them. An example of
53 this list for RFC-3491 is {A.1 C.1.2 C.2.2 C.3 C.4 C.5 C.6 C.7
54 C.8 C.9}.
55
56 Option -prohibitedList specifies a list of additional prohibited
57 characters. The list contains not characters themselves but
58 their Unicode numbers. For example, Nodeprep specification from
59 RFC-3920 forbids the following codes: {0x22 0x26 0x27 0x2f 0x3a
60 0x3c 0x3e 0x40} (\" \& \' / : < > @).
61
62 Option -prohibitedCommand specifies a command which is called
63 for every character code in mapped and normalized string. If the
64 command returns true then the character is considered prohib‐
65 ited. This option is useful when a list for -prohibitedList is
66 too large.
67
68 Option -prohibitedBidi takes boolean value and if it is true
69 then the bidirectional character processing rules defined in
70 section 6 of RFC-3454 are used.
71
72 ::stringprep::stringprep profile string
73 Performs stringprep operations defined in profile profile to
74 string string. Result is a prepared string or one of the follow‐
75 ing errors: invalid_profile (profile profile is not defined),
76 prohibited_character (string string contains a prohibited char‐
77 acter) or prohibited_bidi (string string contains a prohibited
78 bidirectional sequence).
79
80 ::stringprep::compare profile string1 string2
81 Compares two unicode strings prepared accordingly to stringprep
82 profile profile. The command returns 0 if prepared strings are
83 equal, -1 if string1 is lexicographically less than string2, or
84 1 if string1 is lexicographically greater than string2.
85
87 Nameprep profile definition (see RFC-3491):
88
89
90 ::stringprep::register nameprep -mapping {B.1 B.2} -normalization KC -prohibited {A.1 C.1.2 C.2.2 C.3 C.4 C.5 C.6 C.7 C.8 C.9} -prohibitedBidi 1
91
92 Nodeprep and resourceprep profile definitions (see RFC-3920):
93
94
95 ::stringprep::register nodeprep -mapping {B.1 B.2} -normalization KC -prohibited {A.1 C.1.1 C.1.2 C.2.1 C.2.2 C.3 C.4 C.5 C.6 C.7 C.8 C.9} -prohibitedList {0x22 0x26 0x27 0x2f 0x3a 0x3c 0x3e 0x40} -prohibitedBidi 1
96
97 ::stringprep::register resourceprep -mapping {B.1} -normalization KC -prohibited {A.1 C.1.2 C.2.1 C.2.2 C.3 C.4 C.5 C.6 C.7 C.8 C.9} -prohibitedBidi 1
98
99
101 [1] "Preparation of Internationalized Strings ('stringprep')",
102 (http://www.ietf.org/rfc/rfc3454.txt)
103
104 [2] "Nameprep: A Stringprep Profile for Internationalized Domain
105 Names (IDN)", (http://www.ietf.org/rfc/rfc3491.txt)
106
107 [3] "Extensible Messaging and Presence Protocol (XMPP): Core",
108 (http://www.ietf.org/rfc/rfc3920.txt)
109
111 Sergei Golovan
112
114 This document, and the package it describes, will undoubtedly contain
115 bugs and other problems. Please report such in the category stringprep
116 of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please
117 also report any ideas for enhancements you may have for either package
118 and/or documentation.
119
120 When proposing code changes, please provide unified diffs, i.e the out‐
121 put of diff -u.
122
123 Note further that attachments are strongly preferred over inlined
124 patches. Attachments can be made by going to the Edit form of the
125 ticket immediately after its creation, and then using the left-most
126 button in the secondary navigation bar.
127
129 unicode(n)
130
132 stringprep, unicode
133
135 Copyright (c) 2007-2009, Sergei Golovan <sgolovan@nes.ru>
136
137
138
139
140tcllib 1.0.1 stringprep(n)