value_t::dump now faithfully represents strings
This commit is contained in:
parent
b90ec25522
commit
bad1b13680
1 changed files with 15 additions and 1 deletions
16
src/value.cc
16
src/value.cc
|
|
@ -1591,7 +1591,21 @@ void value_t::dump(std::ostream& out, const bool relaxed) const
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STRING:
|
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;
|
break;
|
||||||
|
|
||||||
case MASK:
|
case MASK:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue