From b9cde8d95c0a6cc19a93ed3a2971a12b012dd9b5 Mon Sep 17 00:00:00 2001 From: zc62 Date: Wed, 20 Feb 2019 17:53:02 -0500 Subject: 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 --- sub/filter_sdh.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sub') 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') { -- cgit v1.2.3