about summary refs log tree commit diff
path: root/src/rt/rust_shape.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rt/rust_shape.cpp')
-rw-r--r--src/rt/rust_shape.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/rt/rust_shape.cpp b/src/rt/rust_shape.cpp
index 866bc4ac17a..ef53a7ca7fa 100644
--- a/src/rt/rust_shape.cpp
+++ b/src/rt/rust_shape.cpp
@@ -447,10 +447,19 @@ log::walk_string2(const std::pair<ptr,ptr> &data) {
     ptr subdp = data.first;
     while (subdp < data.second) {
         char ch = *subdp;
-        if (isprint(ch))
-            out << ch;
-        else if (ch)
-            out << "\\x" << std::setw(2) << std::setfill('0') << (int)ch;
+        switch(ch) {
+        case '\n': out << "\\n"; break;
+        case '\r': out << "\\r"; break;
+        case '\t': out << "\\t"; break;
+        case '\\': out << "\\\\"; break;
+        case '"': out << "\\\""; break;
+        default:
+            if (isprint(ch)) {
+                out << ch;
+            } else if (ch) {
+                out << "\\x" << std::setw(2) << std::setfill('0') << (int)ch;
+            }
+        }
         ++subdp;
     }