]> gitweb.factorcode.org Git - factor.git/blob - basis/unicode/normalize/normalize-docs.factor
unicode: make this the API for all unicode things.
[factor.git] / basis / unicode / normalize / normalize-docs.factor
1 USING: help.syntax help.markup strings unicode ;
2 IN: unicode.normalize
3
4 ABOUT: "unicode.normalize"
5
6 ARTICLE: "unicode.normalize" "Unicode normalization"
7 "The " { $vocab-link "unicode.normalize" } " vocabulary defines words for normalizing Unicode strings."
8 $nl
9 "In Unicode, it is often possible to have multiple sequences of characters which really represent exactly the same thing. For example, to represent e with an acute accent above, there are two possible strings: " { $snippet "\"e\\u000301\"" } " (the e character, followed by the combining acute accent character) and " { $snippet "\"\\u0000e9\"" } " (a single character, e with an acute accent)."
10 $nl
11 "There are four normalization forms: NFD, NFC, NFKD, and NFKC. Basically, in NFD and NFKD, everything is expanded, whereas in NFC and NFKC, everything is contracted. In NFKD and NFKC, more things are expanded and contracted. This is a process which loses some information, so it should be done only with care."
12 $nl
13 "Most of the world uses NFC to communicate, but for many purposes, NFD/NFKD is easier to process. For more information, see Unicode Standard Annex #15 and section 3 of the Unicode standard."
14 { $subsections
15     nfc
16     nfd
17     nfkc
18     nfkd
19 } ;
20
21 HELP: nfc
22 { $values { "string" string } { "nfc" "a string in NFC" } }
23 { $description "Converts a string to Normalization Form C." } ;
24
25 HELP: nfd
26 { $values { "string" string } { "nfd" "a string in NFD" } }
27 { $description "Converts a string to Normalization Form D." } ;
28
29 HELP: nfkc
30 { $values { "string" string } { "nfkc" "a string in NFKC" } }
31 { $description "Converts a string to Normalization Form KC." } ;
32
33 HELP: nfkd
34 { $values { "string" string } { "nfkd" "a string in NFKD" } }
35 { $description "Converts a string to Normalization Form KD." } ;