)
Decodes the UTF-8 codeUnits
(a list of unsigned 8-bit integers) to the
corresponding string.
If the codeUnits
start with a leading UNICODE_BOM_CHARACTER_RUNE this
character is discarded.
If allowMalformed
is true
the decoder replaces invalid (or
unterminated) character sequences with the Unicode Replacement character
U+FFFD
(�). Otherwise it throws a FormatException.
If allowMalformed
is not given, it defaults to the allowMalformed
that
was used to instantiate this
.
Source
/**
* Decodes the UTF-8 [codeUnits] (a list of unsigned 8-bit integers) to the
* corresponding string.
*
* If the [codeUnits] start with a leading [UNICODE_BOM_CHARACTER_RUNE] this
* character is discarded.
*
* If [allowMalformed] is `true` the decoder replaces invalid (or
* unterminated) character sequences with the Unicode Replacement character
* `U+FFFD` (�). Otherwise it throws a [FormatException].
*
* If [allowMalformed] is not given, it defaults to the `allowMalformed` that
* was used to instantiate `this`.
*/
String decode(List<int> codeUnits, { bool allowMalformed }) {
if (allowMalformed == null) allowMalformed = _allowMalformed;
return new Utf8Decoder(allowMalformed: allowMalformed).convert(codeUnits);
}