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
method name(Encoding: --> Str)
Gets the primary name of the encoding.
method alternative-names(Encoding: --> List)
Gets a list of alternative names for the encoding.
method decoder(Encoding: * --> 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
translate-nl, which if
True will translate
\n while decoding.
method encoder(Encoding: * --> 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
replacement (either a
Str replacement sequence or
True to use a default replacement sequence for unencodable characters) and
translate-nl (when set to
\r\n if the current platform is Windows).