DEL (0x7f) character needs to be escaped (not printable) in output

This commit is contained in:
Stefan Bühler 2020-03-07 17:10:12 +01:00
parent d0e617e846
commit 4b228e007f
2 changed files with 7 additions and 1 deletions

View File

@ -304,6 +304,12 @@ fn test_TXT() {
None, None,
b"\x0e\xc3\x85LAND ISLANDS", b"\x0e\xc3\x85LAND ISLANDS",
); );
check(
types::TXT,
"\"text with DEL in there: \\127\"",
None,
b"\x19text with DEL in there: \x7f",
);
check( check(
types::TXT, types::TXT,
"\"\u{00c5}LAND ISLANDS\"", "\"\u{00c5}LAND ISLANDS\"",

View File

@ -43,7 +43,7 @@ impl<'a> Iterator for EncodeIterator<'a> {
} }
let b = self.data[0]; let b = self.data[0];
self.data = &self.data[1..]; self.data = &self.data[1..];
if b < 32 || b > 127 || (self.encode_whitespace && is_ascii_whitespace(b)) { if b < 32 || b >= 127 || (self.encode_whitespace && is_ascii_whitespace(b)) {
// `\ddd` // `\ddd`
let d1 = b / 100; let d1 = b / 100;
let d2 = (b / 10) % 10; let d2 = (b / 10) % 10;