Index: src/ostreams.cc |
diff --git a/src/ostreams.cc b/src/ostreams.cc |
index 0f5bec41d2b8b2a48685ddf7425ab6ceeb884df0..847dc31bad6630227c227d2fddd08e305009ee79 100644 |
--- a/src/ostreams.cc |
+++ b/src/ostreams.cc |
@@ -163,6 +163,16 @@ OFStream& OFStream::flush() { |
} |
+OStream& operator<<(OStream& os, const AsReversiblyEscapedUC16& c) { |
+ char buf[10]; |
+ const char* format = (0x20 <= c.value && c.value <= 0x7F) && (c.value != 0x52) |
+ ? "%c" |
+ : (c.value <= 0xff) ? "\\x%02x" : "\\u%04x"; |
+ snprintf(buf, sizeof(buf), format, c.value); |
+ return os << buf; |
+} |
+ |
+ |
OStream& operator<<(OStream& os, const AsUC16& c) { |
char buf[10]; |
const char* format = (0x20 <= c.value && c.value <= 0x7F) |