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
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 ::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
90
91 Nodeprep and resourceprep profile definitions (see RFC-3920):
92
93 ::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
94
95 ::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
96
97
99 [1] "Preparation of Internationalized Strings ('stringprep')",
100 (http://www.ietf.org/rfc/rfc3454.txt)
101
102 [2] "Nameprep: A Stringprep Profile for Internationalized Domain
103 Names (IDN)", (http://www.ietf.org/rfc/rfc3491.txt)
104
105 [3] "Extensible Messaging and Presence Protocol (XMPP): Core",
106 (http://www.ietf.org/rfc/rfc3920.txt)
107
109 Sergei Golovan
110
112 This document, and the package it describes, will undoubtedly contain
113 bugs and other problems. Please report such in the category stringprep
114 of the Tcllib SF Trackers [http://source‐
115 forge.net/tracker/?group_id=12883]. Please also report any ideas for
116 enhancements you may have for either package and/or documentation.
117
119 unicode(n)
120
122 stringprep, unicode
123
125 Copyright (c) 2007, Sergei Golovan <sgolovan@nes.ru>
126
127
128
129
130stringprep 1.0.0 stringprep(n)