Index: src/ostreams.cc |
diff --git a/src/ostreams.cc b/src/ostreams.cc |
index 1385e7cf315a71c964e22e1d5fdad34e72f8b400..4f28141d71aa4667bafd7f4742d97d26b5587636 100644 |
--- a/src/ostreams.cc |
+++ b/src/ostreams.cc |
@@ -66,6 +66,15 @@ std::ostream& operator<<(std::ostream& os, const AsReversiblyEscapedUC16& c) { |
} |
+std::ostream& operator<<(std::ostream& os, const AsEscapedUC16ForJSON& c) { |
+ if (c.value == '\n') return os << "\\n"; |
+ if (c.value == '\r') return os << "\\r"; |
+ if (c.value == '\"') return os << "\\\""; |
+ if (c.value == '\'') return os << "\\\'"; |
+ return PrintUC16(os, c.value, IsOK); |
+} |
+ |
+ |
std::ostream& operator<<(std::ostream& os, const AsUC16& c) { |
return PrintUC16(os, c.value, IsPrint); |
} |