From ad695cf0a5233aef500128d2f21ade95bd5db6d4 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Mon, 27 May 2013 07:42:42 -0700 Subject: [PATCH] Escape the contents of object keys when writing JSON --- aegisub/libaegisub/common/cajun/writer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aegisub/libaegisub/common/cajun/writer.cpp b/aegisub/libaegisub/common/cajun/writer.cpp index dad3801d6..998d23ff4 100644 --- a/aegisub/libaegisub/common/cajun/writer.cpp +++ b/aegisub/libaegisub/common/cajun/writer.cpp @@ -61,7 +61,9 @@ void Writer::Write(Object const& object) { Object::const_iterator it(object.begin()), itend(object.end()); while (it != itend) { - m_ostr << std::string(tab_depth, '\t') << '"' << it->first << "\" : "; + m_ostr << std::string(tab_depth, '\t'); + Write(it->first); + m_ostr << " : "; Write(it->second); if (++it != itend)