diff options
Diffstat (limited to 'src/value.cc')
-rw-r--r-- | src/value.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/value.cc b/src/value.cc index b19ad956..702b889e 100644 --- a/src/value.cc +++ b/src/value.cc @@ -1591,7 +1591,21 @@ void value_t::dump(std::ostream& out, const bool relaxed) const break; case STRING: - out << '"' << as_string() << '"'; + out << '"'; + foreach (const char& ch, as_string()) { + switch (ch) { + case '"': + out << "\\\""; + break; + case '\\': + out << "\\\\"; + break; + default: + out << ch; + break; + } + } + out << '"'; break; case MASK: |