Skip to content

Commit

Permalink
Auto merge of #35084 - tbu-:pr_lowercase_wtf8_debug, r=brson
Browse files Browse the repository at this point in the history
Escape the unmatched surrogates with lower-case hexadecimal numbers

It's done the same way for the rest of the codepoint escapes.
  • Loading branch information
bors committed Aug 2, 2016
2 parents 34d14e7 + bb6c27e commit 97d5be9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libstd/sys/common/wtf8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ impl fmt::Debug for Wtf8 {
&self.bytes[pos .. surrogate_pos]
)},
)?;
write!(formatter, "\\u{{{:X}}}", surrogate)?;
write!(formatter, "\\u{{{:x}}}", surrogate)?;
pos = surrogate_pos + 3;
}
}
Expand Down Expand Up @@ -1066,7 +1066,7 @@ mod tests {
fn wtf8buf_show() {
let mut string = Wtf8Buf::from_str("a\té \u{7f}💩\r");
string.push(CodePoint::from_u32(0xD800).unwrap());
assert_eq!(format!("{:?}", string), "\"a\\\\u{7f}\u{1f4a9}\\r\\u{D800}\"");
assert_eq!(format!("{:?}", string), "\"a\\\\u{7f}\u{1f4a9}\\r\\u{d800}\"");
}

#[test]
Expand Down

0 comments on commit 97d5be9

Please sign in to comment.