summaryrefslogtreecommitdiff
path: root/src/lib/text_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-08-01 02:02:28 +0200
committerCarl Hetherington <cth@carlh.net>2021-08-01 02:02:28 +0200
commit1a9554c281720d0bf54295ab16f593ccc0ef3b4e (patch)
tree5bbdcb49377a1e3e0832250c063563e13ac470e7 /src/lib/text_decoder.cc
parent2306f9cbc7086f6b51aa1cb55eb56b521fb92113 (diff)
Do all text -> HTML conversion for subtitles in the same place.
Previously we would convert > to &gt; then the ampersand to &amp; resulting in &amp;gt;
Diffstat (limited to 'src/lib/text_decoder.cc')
-rw-r--r--src/lib/text_decoder.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/text_decoder.cc b/src/lib/text_decoder.cc
index 0a7bdf95d..6ee6ed079 100644
--- a/src/lib/text_decoder.cc
+++ b/src/lib/text_decoder.cc
@@ -72,10 +72,11 @@ void
TextDecoder::emit_plain_start (ContentTime from, list<dcp::SubtitleString> s)
{
for (auto& i: s) {
- /* We must escape < and > in strings, otherwise they might confuse our subtitle
- renderer (which uses some HTML-esque markup to do bold/italic etc.)
+ /* We must escape some things, otherwise they might confuse our subtitle
+ renderer (which uses entities and some HTML-esque markup to do bold/italic etc.)
*/
string t = i.text ();
+ boost::algorithm::replace_all (t, "&", "&amp;");
boost::algorithm::replace_all (t, "<", "&lt;");
boost::algorithm::replace_all (t, ">", "&gt;");
i.set_text (t);