diff options
author | zc62 <chenzh1993@gmail.com> | 2019-02-20 17:53:02 -0500 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2019-03-02 02:05:58 +0100 |
commit | b9cde8d95c0a6cc19a93ed3a2971a12b012dd9b5 (patch) | |
tree | 87bc65a07dcf6d4c759427ab8224e01b4623e4e7 /sub | |
parent | 8f5a42b1a0764acd392a410ef21e95029352b01f (diff) | |
download | mpv-b9cde8d95c0a6cc19a93ed3a2971a12b012dd9b5.tar.bz2 mpv-b9cde8d95c0a6cc19a93ed3a2971a12b012dd9b5.tar.xz |
sub: recognize UTF-8 characters in SDH subtitle filter
Only printable ASCII characters were considered to be valid texts. Make
it possible that UTF-8 contents are also considered valid.
This does not make the SDH subtitle filter support non-English
languages. This just prevents the filter from blindly marking lines that
have only UTF-8 characters as empty.
Fixes #6502
Diffstat (limited to 'sub')
-rw-r--r-- | sub/filter_sdh.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sub/filter_sdh.c b/sub/filter_sdh.c index ce8c28ed0a..a04f33a23e 100644 --- a/sub/filter_sdh.c +++ b/sub/filter_sdh.c @@ -406,8 +406,11 @@ char *filter_SDH(struct sd *sd, char *format, int n_ignored, char *data, int len line_with_text = true; } } else if (*rp && rp[0] != '\\') { - if (rp[0] > 32 && rp[0] < 127 && rp[0] != '-') + if ((rp[0] > 32 && rp[0] < 127 && rp[0] != '-') || + (unsigned char)rp[0] >= 0xC0) + { line_with_text = true; + } append(sd, buf, rp[0]); rp++; } else if (rp[0] == '\\' && rp[1] != 'N') { |