summaryrefslogtreecommitdiff
path: root/src/subrip_reader.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-01-23 21:44:20 +0000
committerCarl Hetherington <cth@carlh.net>2019-01-23 21:44:20 +0000
commit014bb19876f5b26b9802fa42b573c333ebc09139 (patch)
tree70e0d2f118fe64cb7f1e79037b251b69f0dd5f40 /src/subrip_reader.cc
parent1e1836a2010a9cf421736b25aa0a9f30a268a68b (diff)
Strip Unicode U+202B (right-to-left-embedding) code; it looks like DoM does RTL (at least) partially correctly without this.
Diffstat (limited to 'src/subrip_reader.cc')
-rw-r--r--src/subrip_reader.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/subrip_reader.cc b/src/subrip_reader.cc
index 02ee20a..b5d0446 100644
--- a/src/subrip_reader.cc
+++ b/src/subrip_reader.cc
@@ -42,6 +42,7 @@ using boost::lexical_cast;
using boost::to_upper;
using boost::optional;
using boost::function;
+using boost::algorithm::replace_all;
using namespace sub;
/** @param s Subtitle string encoded in UTF-8 */
@@ -233,6 +234,11 @@ SubripReader::convert_line (string t, RawSubtitle& p)
}
}
+ /* Strip Unicode U+202B (right-to-left embedding) as sometimes it is rendered
+ as a missing character. This may be a hack.
+ */
+ replace_all (p.text, "\xe2\x80\xab", "");
+
maybe_content (p);
}