Browse Source

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

preview
Stefan Bühler 2 years ago
parent
commit
4b228e007f
  1. 6
      lib/dnsbox-base/src/records/powerdns_tests.rs
  2. 2
      lib/dnsbox-base/src/ser/text/quoted.rs

6
lib/dnsbox-base/src/records/powerdns_tests.rs

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

2
lib/dnsbox-base/src/ser/text/quoted.rs

@ -43,7 +43,7 @@ impl<'a> Iterator for EncodeIterator<'a> {
}
let b = self.data[0];
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`
let d1 = b / 100;
let d2 = (b / 10) % 10;

Loading…
Cancel
Save