Added #116 Show invalid utf-8 bytes in Strings as {invalid_utf8:xxx}

This commit is contained in:
Jindra Petřík
2023-10-08 16:53:57 +02:00
parent 98b7ac100e
commit b6e8ca0d67
7 changed files with 162 additions and 7 deletions

View File

@@ -508,7 +508,10 @@ public class SWFInputStream implements AutoCloseable {
r = readEx();
if (r == 0) {
endDumpLevel();
return new String(baos.toByteArray(), swf == null ? Utf8Helper.charsetName : swf.getCharset());
if (swf == null || "UTF-8".equals(swf.getCharset())) {
return Utf8Helper.decode(baos.toByteArray());
}
return new String(baos.toByteArray(), swf.getCharset());
}
baos.write(r);
}