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:
parent
a30f5f1b50
commit
dd26c09003
@ -177,7 +177,7 @@ class Utils {
|
|||||||
*/
|
*/
|
||||||
static printable(str, preserveWs=false, onlyAscii=false) {
|
static printable(str, preserveWs=false, onlyAscii=false) {
|
||||||
if (onlyAscii) {
|
if (onlyAscii) {
|
||||||
return str.replace(/[^\x20-\x7f]/g, ".");
|
return str.replace(/[^\x20-\x7e]/g, ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-misleading-character-class
|
// eslint-disable-next-line no-misleading-character-class
|
||||||
|
|||||||
@ -20,4 +20,10 @@ TestRegister.addApiTests([
|
|||||||
assert.equal(Utils.parseEscapedChars("\\\\\\'"), "\\'");
|
assert.equal(Utils.parseEscapedChars("\\\\\\'"), "\\'");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
it("Utils: should replace delete character", () => {
|
||||||
|
assert.equal(
|
||||||
|
Utils.printable("\x7e\x7f\x80\xa7", false, true),
|
||||||
|
"\x7e...",
|
||||||
|
);
|
||||||
|
}),
|
||||||
]);
|
]);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user