From 35716b53dbd63f4eeacffc989a705dbcd4ef9f41 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 28 Dec 2016 15:31:25 +0100 Subject: charset_conv: fix "auto" fallback with uchardet not compiled Tried to open iconv with "auto" as source codepage, instead of using the latin1 fallback. This also neutralizes the libavcodec dumbass UTF-8 check, which discards subtitles not in UTF-8 and shows an error message for ffmpeg CLI instead. Fixes #3954. --- misc/charset_conv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'misc') diff --git a/misc/charset_conv.c b/misc/charset_conv.c index 1758223f1a..b66b73907d 100644 --- a/misc/charset_conv.c +++ b/misc/charset_conv.c @@ -191,7 +191,7 @@ const char *mp_charset_guess(void *talloc_ctx, struct mp_log *log, bstr buf, return "utf-8"; } - const char *res = user_cp; + const char *res = NULL; if (strcasecmp(user_cp, "auto") == 0) { #if HAVE_UCHARDET res = mp_uchardet(talloc_ctx, log, buf); @@ -200,6 +200,8 @@ const char *mp_charset_guess(void *talloc_ctx, struct mp_log *log, bstr buf, mp_verbose(log, "Charset auto-detection failed.\n"); res = "UTF-8-BROKEN"; } + } else { + res = user_cp; } mp_verbose(log, "Using charset '%s'.\n", res); -- cgit v1.2.3