Support for encoding and decoding Unicode characters in UTF-8, UTF-16, and UTF-32.
Invalid codepoints or encodings may be substituted with the value U+fffd.
Generate a string from the provided Unicode codepoints.
Deprecated Use String.fromCharCodes
instead.
Encode code points as UTF-8 code units.
Produce a String from a sequence of UTF-16 encoded bytes. This method always strips a leading BOM. Set the replacementCodepoint
to null to throw an ArgumentError rather than replace the bad value. The default value for the replacementCodepoint
is U+FFFD.
Decodes the UTF-16 bytes as an iterable. Thus, the consumer can only convert as much of the input as needed. Determines the byte order from the BOM, or uses big-endian as a default. This method always strips a leading BOM. Set the replacementCodepoint
to null to throw an ArgumentError rather than replace the bad value. The default value for replacementCodepoint
is U+FFFD.
Produce a String from a sequence of UTF-16BE encoded bytes. This method strips a leading BOM by default, but can be overridden by setting the optional parameter stripBom
to false. Set the replacementCodepoint
to null to throw an ArgumentError rather than replace the bad value. The default value for the replacementCodepoint
is U+FFFD.
Decodes the UTF-16BE bytes as an iterable. Thus, the consumer can only convert as much of the input as needed. This method strips a leading BOM by default, but can be overridden by setting the optional parameter stripBom
to false. Set the replacementCodepoint
to null to throw an ArgumentError rather than replace the bad value. The default value for the replacementCodepoint
is U+FFFD.
Produce a String from a sequence of UTF-16LE encoded bytes. This method strips a leading BOM by default, but can be overridden by setting the optional parameter stripBom
to false. Set the replacementCodepoint
to null to throw an ArgumentError rather than replace the bad value. The default value for the replacementCodepoint
is U+FFFD.
Decodes the UTF-16LE bytes as an iterable. Thus, the consumer can only convert as much of the input as needed. This method strips a leading BOM by default, but can be overridden by setting the optional parameter stripBom
to false. Set the replacementCodepoint
to null to throw an ArgumentError rather than replace the bad value. The default value for the replacementCodepoint
is U+FFFD.
Produce a String from a sequence of UTF-32 encoded bytes. The parameters allow an offset into a list of bytes (as int), limiting the length of the values be decoded and the ability of override the default Unicode replacement character. Set the replacementCharacter to null to throw an ArgumentError rather than replace the bad value.
Decodes the UTF-32 bytes as an iterable. Thus, the consumer can only convert as much of the input as needed. Determines the byte order from the BOM, or uses big-endian as a default. This method always strips a leading BOM. Set the replacementCharacter to null to throw an ArgumentError rather than replace the bad value.
Produce a String from a sequence of UTF-32BE encoded bytes. The parameters allow an offset into a list of bytes (as int), limiting the length of the values be decoded and the ability of override the default Unicode replacement character. Set the replacementCharacter to null to throw an ArgumentError rather than replace the bad value.
Decodes the UTF-32BE bytes as an iterable. Thus, the consumer can only convert as much of the input as needed. This method strips a leading BOM by default, but can be overridden by setting the optional parameter stripBom
to false. Set the replacementCharacter to null to throw an ArgumentError rather than replace the bad value.
Produce a String from a sequence of UTF-32LE encoded bytes. The parameters allow an offset into a list of bytes (as int), limiting the length of the values be decoded and the ability of override the default Unicode replacement character. Set the replacementCharacter to null to throw an ArgumentError rather than replace the bad value.
Decodes the UTF-32LE bytes as an iterable. Thus, the consumer can only convert as much of the input as needed. This method strips a leading BOM by default, but can be overridden by setting the optional parameter stripBom
to false. Set the replacementCharacter to null to throw an ArgumentError rather than replace the bad value.
Produce a String from a List of UTF-8 encoded bytes. The parameters can set an offset into a list of bytes (as int), limit the length of the values to be decoded, and override the default Unicode replacement character. Set the replacementCharacter to null to throw an ArgumentError rather than replace the bad value.
Decodes the UTF-8 bytes as an iterable. Thus, the consumer can only convert as much of the input as needed. Set the replacementCharacter to null to throw an ArgumentError rather than replace the bad value.
Produce a list of UTF-16 encoded bytes. This method prefixes the resulting bytes with a big-endian byte-order-marker.
Produce a list of UTF-16BE encoded bytes. By default, this method produces UTF-16BE bytes with no BOM.
Produce a list of UTF-16LE encoded bytes. By default, this method produces UTF-16LE bytes with no BOM.
Produce a list of UTF-32 encoded bytes. This method prefixes the resulting bytes with a big-endian byte-order-marker.
Produce a list of UTF-32BE encoded bytes. By default, this method produces UTF-32BE bytes with no BOM.
Produce a list of UTF-32LE encoded bytes. By default, this method produces UTF-32BE bytes with no BOM.
Produce a sequence of UTF-8 encoded bytes from the provided string.
Identifies whether a List of bytes starts (based on offset) with a byte-order marker (BOM).
Identifies whether a List of bytes starts (based on offset) with a big-endian byte-order marker (BOM).
Identifies whether a List of bytes starts (based on offset) with a little-endian byte-order marker (BOM).
Identifies whether a List of bytes starts (based on offset) with a byte-order marker (BOM).
Identifies whether a List of bytes starts (based on offset) with a big-endian byte-order marker (BOM).
Identifies whether a List of bytes starts (based on offset) with a little-endian byte-order marker (BOM).
Provide a list of Unicode codepoints for a given string.
Return type of decodeUtf16AsIterable
and variants. The Iterable type provides an iterator on demand and the iterator will only translate bytes as requested by the user of the iterator. (Note: results are not cached.)
Return type of decodeUtf32AsIterable
and variants. The Iterable type provides an iterator on demand and the iterator will only translate bytes as requested by the user of the iterator. (Note: results are not cached.)
Return type of decodeUtf8AsIterable
and variants. The Iterable type provides an iterator on demand and the iterator will only translate bytes as requested by the user of the iterator. (Note: results are not cached.)
Convert UTF-16 encoded bytes to UTF-16 code units by grouping 1-2 bytes to produce the code unit (0-(2^16)-1). Relies on BOM to determine endian-ness, and defaults to BE.
Provides a fast way to decode the rest of the source bytes in a single call. This method trades memory for improved speed in that it potentially over-allocates the List containing results.
Moves to the next element. Returns true if current
contains the next element. Returns false, if no element was left.
It is safe to invoke moveNext
even when the iterator is already positioned after the last element. In this case moveNext
has no effect.
An Iterator<int> of codepoints built on an Iterator of UTF-16 code units. The parameters can override the default Unicode replacement character. Set the replacementCharacter to null to throw an ArgumentError rather than replace the bad value.
Moves to the next element. Returns true if current
contains the next element. Returns false, if no element was left.
It is safe to invoke moveNext
even when the iterator is already positioned after the last element. In this case moveNext
has no effect.
Convert UTF-16BE encoded bytes to utf16 code units by grouping 1-2 bytes to produce the code unit (0-(2^16)-1).
Convert UTF-16LE encoded bytes to utf16 code units by grouping 1-2 bytes to produce the code unit (0-(2^16)-1).
Abstrace parent class converts encoded bytes to codepoints.
Moves to the next element. Returns true if current
contains the next element. Returns false, if no element was left.
It is safe to invoke moveNext
even when the iterator is already positioned after the last element. In this case moveNext
has no effect.
Convert UTF-32BE encoded bytes to codepoints by grouping 4 bytes to produce the unicode codepoint.
Convert UTF-32BE encoded bytes to codepoints by grouping 4 bytes to produce the unicode codepoint.
Provides an iterator of Unicode codepoints from UTF-8 encoded bytes. The parameters can set an offset into a list of bytes (as int), limit the length of the values to be decoded, and override the default Unicode replacement character. Set the replacementCharacter to null to throw an ArgumentError rather than replace the bad value. The return value from this method can be used as an Iterable (e.g. in a for-loop).
Decode the remaininder of the characters in this decoder into a List<int>
.
Moves to the next element. Returns true if current
contains the next element. Returns false, if no element was left.
It is safe to invoke moveNext
even when the iterator is already positioned after the last element. In this case moveNext
has no effect.
StringTransformer that decodes a stream of UTF-8 encoded bytes.
StringTransformer that UTF-8 encodes a stream of strings.