convert method
Converts input
and returns the result of the conversion.
Implementation
@override
convert(input) {
List<int> result = [];
for (int i = 0; i < input.length; i++) {
final c1 = input[i];
final List<int>? codes;
if (c1 <= 0x7E) {
// ASCII Compatible
codes = eucTable[c1];
} else if (c1 == 0x8e) {
// Hiragana
final c2 = input[++i];
codes = eucTable[(c1 << 8) + c2];
} else if (c1 == 0x8f) {
// JIS X 0212
final c2 = input[++i];
final c3 = input[++i];
codes = eucTable[(c1 << 16) + (c2 << 8) + c3];
} else {
// JIS X 0208
final c2 = input[++i];
codes = eucTable[(c1 << 8) + c2];
}
if (codes == null) {
if (_allowMalformed) {
throw FormatException('Unfinished Euc-JP octet sequence', input, i);
}
result.add(unicodeReplacementCharacterRune);
} else {
result.addAll(codes);
}
}
return utf8.decode(result);
}