summaryrefslogtreecommitdiff
path: root/src/value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-06-28 16:00:29 +0100
committerJohn Wiegley <johnw@newartisans.com>2009-06-28 16:00:29 +0100
commitbad1b1368031ce0b1de1517ca696d83351941eed (patch)
treeb3e1db1a9984b7a4fee2f7e201b76436d019f7bd /src/value.cc
parentb90ec255221a90f34d313b7f3433e7d686a7b1c9 (diff)
downloadfork-ledger-bad1b1368031ce0b1de1517ca696d83351941eed.tar.gz
fork-ledger-bad1b1368031ce0b1de1517ca696d83351941eed.tar.bz2
fork-ledger-bad1b1368031ce0b1de1517ca696d83351941eed.zip
value_t::dump now faithfully represents strings
Diffstat (limited to 'src/value.cc')
-rw-r--r--src/value.cc16
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: