Fix errors with SSA subtitles containing commas.
authorCarl Hetherington <cth@carlh.net>
Thu, 2 Jun 2016 19:06:36 +0000 (20:06 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 2 Jun 2016 19:06:36 +0000 (20:06 +0100)
src/ssa_reader.cc

index 859a00ecba18cbb36ab79ba2a51ba01151ae3658..c76a78db34d006c4244e40f4d8e7423edfd5fc14 100644 (file)
@@ -274,6 +274,15 @@ SSAReader::read (function<optional<string> ()> get_line)
                                vector<string> event;
                                split (event, body, is_any_of (","));
 
+                               /* There may be commas in the subtitle part; reassemble any extra parts
+                                  from when we just split it.
+                               */
+                               while (event.size() > event_format.size()) {
+                                       string const ex = event.back ();
+                                       event.pop_back ();
+                                       event.back() += "," + ex;
+                               }
+
                                SUB_ASSERT (!event.empty());
                                SUB_ASSERT (event_format.size() == event.size());