summaryrefslogtreecommitdiff
path: root/src/subtitle_asset.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/subtitle_asset.cc')
-rw-r--r--src/subtitle_asset.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc
index de6332e6..bd8bb993 100644
--- a/src/subtitle_asset.cc
+++ b/src/subtitle_asset.cc
@@ -803,6 +803,8 @@ SubtitleAsset::fix_empty_font_ids ()
}
+namespace {
+
struct State
{
int indent;
@@ -810,13 +812,19 @@ struct State
int disable_formatting;
};
+}
+
static
void
format_xml_node (xmlpp::Node const* node, State& state)
{
if (auto text_node = dynamic_cast<const xmlpp::TextNode*>(node)) {
- state.xml += text_node->get_content();
+ string content = text_node->get_content();
+ boost::replace_all(content, "&", "&amp;");
+ boost::replace_all(content, "<", "&lt;");
+ boost::replace_all(content, ">", "&gt;");
+ state.xml += content;
} else if (auto element = dynamic_cast<const xmlpp::Element*>(node)) {
++state.indent;