Exclude Delete character from hex dump output (#2086)

Co-authored-by: GCHQ Developer C85297 <95289555+C85297@users.noreply.github.com>
This commit is contained in:
みけCAT 2026-01-30 00:00:17 +09:00 committed by GitHub
parent a30f5f1b50
commit dd26c09003
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -177,7 +177,7 @@ class Utils {
*/
static printable(str, preserveWs=false, onlyAscii=false) {
if (onlyAscii) {
return str.replace(/[^\x20-\x7f]/g, ".");
return str.replace(/[^\x20-\x7e]/g, ".");
}
// eslint-disable-next-line no-misleading-character-class

View File

@ -20,4 +20,10 @@ TestRegister.addApiTests([
assert.equal(Utils.parseEscapedChars("\\\\\\'"), "\\'");
}),
it("Utils: should replace delete character", () => {
assert.equal(
Utils.printable("\x7e\x7f\x80\xa7", false, true),
"\x7e...",
);
}),
]);