]> gitweb.factorcode.org Git - factor.git/blob - core/io/encodings/utf16/utf16-docs.factor
Merge branch 'master' into unicode
[factor.git] / core / io / encodings / utf16 / utf16-docs.factor
1 USING: help.markup help.syntax io.encodings strings ;
2 IN: io.encodings.utf16
3
4 ARTICLE: "io.utf16" "Working with UTF16-encoded data"
5 "The UTF16 encoding is a variable-width encoding. Unicode code points are encoded as 2 or 4 byte sequences."
6 { $subsection encode-utf16le }
7 { $subsection encode-utf16be }
8 { $subsection decode-utf16le }
9 { $subsection decode-utf16be }
10 "Support for UTF16 data with a byte order mark:"
11 { $subsection encode-utf16 }
12 { $subsection decode-utf16 } ;
13
14 ABOUT: "io.utf16"
15
16 HELP: decode-utf16
17 { $values { "seq" "a sequence of bytes" } { "str" string } }
18 { $description "Decodes a sequence of bytes representing a Unicode string in UTF16 format. The bytes must begin with a UTF16 byte order mark, which determines if the input is in little or big endian. To decode data without a byte order mark, use " { $link decode-utf16le } " or " { $link decode-utf16be } "." }
19 { $errors "Throws a " { $link decode-error } " if the input is malformed." } ;
20
21 HELP: decode-utf16be
22 { $values { "seq" "a sequence of bytes" } { "str" string } }
23 { $description "Decodes a sequence of bytes representing a Unicode string in big endian UTF16 format. The bytes must not begin with a UTF16 byte order mark. To decode data with a byte order mark, use " { $link decode-utf16 } "." }
24 { $errors "Throws a " { $link decode-error } " if the input is malformed." } ;
25
26 HELP: decode-utf16le
27 { $values { "seq" "a sequence of bytes" } { "str" string } }
28 { $description "Decodes a sequence of bytes representing a Unicode string in little endian UTF16 format. The bytes must not begin with a UTF16 byte order mark. To decode data with a byte order mark, use " { $link decode-utf16 } "." }
29 { $errors "Throws a " { $link decode-error } " if the input is malformed." } ;
30
31 { decode-utf16 decode-utf16le decode-utf16be } related-words
32
33 HELP: encode-utf16be
34 { $values { "str" string } { "seq" "a sequence of bytes" } }
35 { $description "Encodes a Unicode string as a sequence of bytes in big endian UTF16 format." } ;
36
37 HELP: encode-utf16le
38 { $values { "str" string } { "seq" "a sequence of bytes" } }
39 { $description "Encodes a Unicode string as a sequence of bytes in little endian UTF16 format." } ;
40
41 HELP: encode-utf16
42 { $values { "str" string } { "seq" "a sequence of bytes" } }
43 { $description "Encodes a Unicode string as a sequence of bytes in UTF16 format with a byte order mark." } ;
44
45 { encode-utf16 encode-utf16be encode-utf16le } related-words