1unicode(n) Unicode normalization unicode(n)
2
3
4
5______________________________________________________________________________
6
8 unicode - Implementation of Unicode normalization
9
11 package require Tcl 8.3
12
13 package require unicode 1.0
14
15 ::unicode::fromstring string
16
17 ::unicode::tostring uclist
18
19 ::unicode::normalize form uclist
20
21 ::unicode::normalizeS form string
22
23______________________________________________________________________________
24
26 This is an implementation in Tcl of the Unicode normalization forms.
27
29 ::unicode::fromstring string
30 Converts string to list of integer Unicode character codes which
31 is used in unicode for internal string representation.
32
33 ::unicode::tostring uclist
34 Converts list of integers uclist back to Tcl string.
35
36 ::unicode::normalize form uclist
37 Normalizes Unicode characters list ulist according to form and
38 returns the normalized list. Form form takes one of the follow‐
39 ing values: D (canonical decomposition), C (canonical decomposi‐
40 tion, followed by canonical composition), KD (compatibility
41 decomposition), or KC (compatibility decomposition, followed by
42 canonical composition).
43
44 ::unicode::normalizeS form string
45 A shortcut to ::unicode::tostring [unicode::normalize \$form
46 [::unicode::fromstring \$string]]. Normalizes Tcl string and
47 returns normalized string.
48
50 % ::unicode::fromstring "\u0410\u0411\u0412\u0413"
51 1040 1041 1042 1043
52 % ::unicode::tostring {49 50 51 52 53}
53 12345
54 %
55
56
57
58 % ::unicode::normalize D {7692 775}
59 68 803 775
60 % ::unicode::normalizeS KD "\u1d2c"
61 A
62 %
63
64
66 [1] "Unicode Standard Annex #15: Unicode Normalization Forms",
67 (http://unicode.org/reports/tr15/)
68
70 Sergei Golovan
71
73 This document, and the package it describes, will undoubtedly contain
74 bugs and other problems. Please report such in the category stringprep
75 of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please
76 also report any ideas for enhancements you may have for either package
77 and/or documentation.
78
79 When proposing code changes, please provide unified diffs, i.e the out‐
80 put of diff -u.
81
82 Note further that attachments are strongly preferred over inlined
83 patches. Attachments can be made by going to the Edit form of the
84 ticket immediately after its creation, and then using the left-most
85 button in the secondary navigation bar.
86
88 stringprep(n)
89
91 normalization, unicode
92
94 Copyright (c) 2007, Sergei Golovan <sgolovan@nes.ru>
95
96
97
98
99tcllib 1.0.0 unicode(n)