value_t::dump now faithfully represents strings

This commit is contained in:
John Wiegley 2009-06-28 16:00:29 +01:00
parent b90ec25522
commit bad1b13680

View file

@ -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: