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.
This commit is contained in:
wm4 2016-12-28 15:31:25 +01:00
parent 22a22322cb
commit 35716b53db
1 changed files with 3 additions and 1 deletions

View File

@ -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);