/
Encoding.pod6
51 lines (32 loc) 路 1.48 KB
/
Encoding.pod6
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
=begin pod
=TITLE role Encoding
=SUBTITLE ...
role Encoding { ... }
The C<Encoding> role is implemented by objects that provide a character
encoding, such as ASCII or UTF-8. Besides being implemented by the built-in
character encodings, it may also be implemented by users to provide new
encodings. Instances of objects doing this role are typically obtained using
C<Encoding::Registry>.
=head1 Methods
=head2 method name
method name(Encoding:D: --> Str)
Gets the primary name of the encoding.
=head2 method alternative-names
method alternative-names(Encoding:D: --> List)
Gets a list of alternative names for the encoding.
=head2 method decoder
method decoder(Encoding:D: *%options --> Encoding::Decoder)
Gets a character decoder instance for this encoding, configured with the
provided options. Options vary by encoding. The built-in encodings all
support C<translate-nl>, which if C<True> will translate C<\r\n> into
C<\n> while decoding.
=head2 method encoder
method encoder(Encoding:D: *%options --> Encoding::Encoder)
Gets a character encoder instance for this encoding, configured with the
provided options. Options vary by encoding. The built-in encodings all support
both C<replacement> (either a C<Str> replacement sequence or C<True> to use a
default replacement sequence for unencodable characters) and C<translate-nl>
(when set to C<True>, turns C<\n> into C<\r\n> if the current platform is
Windows).
=end pod
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6