file_streams/text_encoding
The encodings available for reading and writing text with a file stream.
Types
Endianness specifier used by the Utf16
and Utf32
text encodings.
pub type Endianness {
Big
Little
}
Constructors
-
Big
Big endian. This is much less common than little endian.
-
Little
Little endian. This is much more common than big endian.
Text encoding for a file stream. The default encoding is Unicode
(UTF-8).
Text read from a file stream using
file_stream.read_chars()
and
file_stream.read_line()
will be
automatically converted from the specified encoding to a String
.
Similarly, text written to a file stream using
file_stream.write_chars()
will be
converted to the specified encoding before being written to a file stream.
pub type TextEncoding {
Unicode
Latin1
Utf16(endianness: Endianness)
Utf32(endianness: Endianness)
}
Constructors
-
Unicode
The Unicode UTF-8 text encoding. This is the default encoding.
-
Latin1
The ISO 8859-1 (Latin-1) text encoding.
When using this encoding,
file_stream.write_chars()
can only write Unicode codepoints up toU+00FF
. -
Utf16(endianness: Endianness)
The Unicode UTF-16 text encoding, with the specified byte ordering.
-
Utf32(endianness: Endianness)
The Unicode UTF-32 text encoding, with the specified byte ordering.