File: stringprep.man

package info (click to toggle)
tcllib 1.20%2Bdfsg-1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 68,064 kB
  • sloc: tcl: 216,842; ansic: 14,250; sh: 2,846; xml: 1,766; yacc: 1,145; pascal: 881; makefile: 107; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (151 lines) | stat: -rw-r--r-- 4,916 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin stringprep n 1.0.1]
[see_also unicode(n)]
[keywords stringprep]
[keywords unicode]
[copyright {2007-2009, Sergei Golovan <sgolovan@nes.ru>}]
[moddesc {Preparation of Internationalized Strings}]
[titledesc {Implementation of stringprep}]
[require Tcl 8.3]
[require stringprep 1.0.1]
[description]
[para]

This is an implementation in Tcl of the Preparation of Internationalized
Strings ("stringprep"). It allows to define stringprep profiles and use
them to prepare Unicode strings for comparison as defined in RFC-3454.

[section "COMMANDS"]

[list_begin definitions]
[call [cmd "::stringprep::register"] \
        [arg profile] \
        [opt [arg "-mapping list"]] \
        [opt [arg "-normalization form"]] \
        [opt [arg "-prohibited list"]] \
        [opt [arg "-prohibitedList list"]] \
        [opt [arg "-prohibitedCommand command"]] \
        [opt [arg "-prohibitedBidi boolean"]]]

Register the [package stringprep] profile named [arg profile]. Options
are the following.

[para]

Option [arg -mapping] specifies [package stringprep] mapping tables.
This parameter takes list of tables from appendix B of RFC-3454. The usual
list values are {B.1 B.2} or {B.1 B.3} where B.1 contains characters which
commonly map to nothing, B.3 specifies case folding, and B.2 is used in
profiles with unicode normalization form KC. Defult value is {} which means
no mapping.

[para]

Option [arg -normalization] takes a string and if it is nonempty then it
uses as a name of Unicode normalization form. Any value of "D", "C", "KD"
or "KC" may be used, though RFC-3454 defines only two options: no
normalization or normalization using form KC.

[para]

Option [arg -prohibited] takes a list of RFC-3454 tables with prohibited
characters. Current version does allow to prohibit either all tables from
C.3 to C.9 or neither of them. An example of this list for RFC-3491 is
{A.1 C.1.2 C.2.2 C.3 C.4 C.5 C.6 C.7 C.8 C.9}.

[para]

Option [arg -prohibitedList] specifies a list of additional prohibited
characters. The list contains not characters themselves but their Unicode
numbers. For example, Nodeprep specification from RFC-3920 forbids the
following codes: {0x22 0x26 0x27 0x2f 0x3a 0x3c 0x3e 0x40} (\" \& \' / : < > @).

[para]

Option [arg -prohibitedCommand] specifies a command which is called for
every character code in mapped and normalized string. If the command returns
true then the character is considered prohibited. This option is useful when
a list for [arg -prohibitedList] is too large.

[para]

Option [arg -prohibitedBidi] takes boolean value and if it is true then the
bidirectional character processing rules defined in section 6 of RFC-3454 are
used.

[call [cmd "::stringprep::stringprep"] \
        [arg profile] \
        [arg string]]

Performs [package stringprep] operations defined in profile [arg profile]
to string [arg string]. Result is a prepared string or one of the following
errors: [arg invalid_profile] (profile [arg profile] is not defined),
[arg prohibited_character] (string [arg string] contains a prohibited character)
or [arg prohibited_bidi] (string [arg string] contains a prohibited bidirectional
sequence).

[call [cmd "::stringprep::compare"] \
        [arg profile] \
        [arg string1] \
        [arg string2]]

Compares two unicode strings prepared accordingly to [package stringprep]
profile [arg profile]. The command returns 0 if prepared strings are equal,
-1 if [arg string1] is lexicographically less than [arg string2], or
1 if [arg string1] is lexicographically greater than [arg string2].

[list_end]

[section EXAMPLES]

Nameprep profile definition (see RFC-3491):

[example {
::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
}]

Nodeprep and resourceprep profile definitions (see RFC-3920):

[example {
::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

::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
}]

[section "REFERENCES"]

[list_begin enum]

[enum]
    "Preparation of Internationalized Strings ('stringprep')",
    ([uri http://www.ietf.org/rfc/rfc3454.txt])

[enum]
    "Nameprep: A Stringprep Profile for Internationalized Domain Names (IDN)",
    ([uri http://www.ietf.org/rfc/rfc3491.txt])

[enum]
    "Extensible Messaging and Presence Protocol (XMPP): Core",
    ([uri http://www.ietf.org/rfc/rfc3920.txt])

[list_end]

[section "AUTHORS"]
Sergei Golovan

[vset CATEGORY stringprep]
[include ../common-text/feedback.inc]
[manpage_end]