From bad1b1368031ce0b1de1517ca696d83351941eed Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 28 Jun 2009 16:00:29 +0100 Subject: [PATCH] value_t::dump now faithfully represents strings --- src/value.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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: