Skip to content

Commit 3568a47

Browse files
committed
Fix string octal escape encoding
The bug affected invisible ASCII characters that have one of the two high bits set, so only DEL.
1 parent 1ae6a71 commit 3568a47

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

src/buf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl BufExt for Vec<u8> {
7676
}
7777

7878
self.push(octal(value >> 6));
79-
self.push(octal((value >> 3) & 63));
79+
self.push(octal((value >> 3) & 7));
8080
self.push(octal(value & 7));
8181
}
8282
}

src/object.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,7 @@ mod tests {
10881088
test_primitive!(Str(br"\n"), br"(\\n)");
10891089
test_primitive!(Str(b"a\x14b"), br"(a\024b)");
10901090
test_primitive!(Str(b"\xFF\xAA"), b"<FFAA>");
1091+
test_primitive!(Str(b"\x0A\x7F\x1F"), br"(\n\177\037)");
10911092

10921093
// Test text strings.
10931094
test_primitive!(TextStr("Hallo"), b"(Hallo)");

0 commit comments

Comments
 (0)