summaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-12-28 15:31:25 +0100
committerwm4 <wm4@nowhere>2016-12-28 15:31:25 +0100
commit35716b53dbd63f4eeacffc989a705dbcd4ef9f41 (patch)
treee83a01209ea33b5989977da4e1f3b4f4515f6f82 /misc
parent22a22322cb612e9cff6ae642668f86dd15314598 (diff)
downloadmpv-35716b53dbd63f4eeacffc989a705dbcd4ef9f41.tar.bz2
mpv-35716b53dbd63f4eeacffc989a705dbcd4ef9f41.tar.xz
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.
Diffstat (limited to 'misc')
-rw-r--r--misc/charset_conv.c4
1 files changed, 3 insertions, 1 deletions
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);