role Encoding

Support for character encodings.
role Encoding { ... }

The Encoding role is implemented by classes that provide a character encoding, such as ASCII or UTF-8. Besides being used 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 Encoding::Registry. For a list of supported encodings, see IO::Handle.

All methods provided by this role are stubs; they should be implemented by consumers of the role.

Methods

method name

method name(--> Str)

Abstract method that would return the primary name of the encoding.

method alternative-names

method alternative-names()

Abstract methods that should get a list of alternative names for the encoding.

method decoder

method decoder(*%options --> Encoding::Decoder)

Should get 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 \r\n into \n while decoding.

method encoder

method encoder(*%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 replacement (either a Str replacement sequence or True to use a default replacement sequence for unencodable characters) and translate-nl (when set to True, turns \n into \r\n if the current platform is Windows).

See Also

role Callable

Invocable code object

role Dateish

Object that can be treated as a date

role Distribution

Distribution

role PredictiveIterator

Iterators that can predict number of values

class RakuAST::Doc::DeclaratorTarget

Provide leading/trailing doc functionality

role Rational

Number stored as numerator and denominator

role Real

Non-complex number

role Stringy

String or object that can act as a string

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.