Filter out the control code in text value
@@ -736,18 +736,14 @@ where
let values = values.into_iter();
let len = values.len();
let mut pieces = values.take(64).map(|piece| {
- if quoted {
let mut piece = piece.to_string();
- if piece.contains('\"') {
- format!("\"{}\"", piece.replace("\"", "\\\""))
- } else {
+ piece.retain(|c| !c.is_control());
+ if quoted {
+ piece = piece.replace("\"", "\\\"");
piece.insert(0, '"');
piece.push('"');
- piece
- }
- } else {
- piece.to_string()
}
+ piece
});
let mut pieces = pieces.join(", ");
if len > 1 {
