set allowMalformed to true when decode utf8 (#12693)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2025-08-20 14:55:52 +08:00
committed by GitHub
parent e0ab3f0c92
commit 5ff1740b5b
5 changed files with 27 additions and 15 deletions

View File

@@ -304,14 +304,14 @@ class TerminalModel with ChangeNotifier {
// Try to decode as base64 first
try {
final bytes = base64Decode(data);
text = utf8.decode(bytes);
text = utf8.decode(bytes, allowMalformed: true);
} catch (e) {
// If base64 decode fails, treat as plain text
text = data;
}
} else if (data is List) {
// Handle if data comes as byte array
text = utf8.decode(List<int>.from(data));
text = utf8.decode(List<int>.from(data), allowMalformed: true);
} else {
debugPrint('[TerminalModel] Unknown data type: ${data.runtimeType}');
return;