Commit 311af61b authored by KO Myung-Hun's avatar KO Myung-Hun Committed by Rémi Denis-Courmont

subsdec: check UTF-8 autodetection if encoding is not known in ES format

This enables to show UTF-8 subtitles even though subsdec-encoding is set to
a non-UTF-8 value.
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent 75f2a236
...@@ -262,23 +262,24 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -262,23 +262,24 @@ static int OpenDecoder( vlc_object_t *p_this )
encoding); encoding);
} }
else else
/* Second, try configured encoding */
if ((var = var_InheritString (p_dec, "subsdec-encoding")) != NULL)
{ {
msg_Dbg (p_dec, "trying configured character encoding: %s", var); /* Second, try configured encoding */
if (!strcmp (var, "system")) if ((var = var_InheritString (p_dec, "subsdec-encoding")) != NULL)
{ {
free (var); msg_Dbg (p_dec, "trying configured character encoding: %s", var);
var = NULL; if (!strcmp (var, "system"))
encoding = ""; {
/* ^ iconv() treats "" as nl_langinfo(CODESET) */ free (var);
var = NULL;
encoding = "";
/* ^ iconv() treats "" as nl_langinfo(CODESET) */
}
else
encoding = var;
} }
else else
encoding = var; /* Third, try "local" encoding */
} {
else
/* Third, try "local" encoding with optional UTF-8 autodetection */
{
/* xgettext: /* xgettext:
The Windows ANSI code page most commonly used for this language. The Windows ANSI code page most commonly used for this language.
VLC uses this as a guess of the subtitle files character set VLC uses this as a guess of the subtitle files character set
...@@ -289,8 +290,11 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -289,8 +290,11 @@ static int OpenDecoder( vlc_object_t *p_this )
This MUST be a valid iconv character set. If unsure, please refer This MUST be a valid iconv character set. If unsure, please refer
the VideoLAN translators mailing list. */ the VideoLAN translators mailing list. */
encoding = vlc_pgettext("GetACP", "CP1252"); encoding = vlc_pgettext("GetACP", "CP1252");
msg_Dbg (p_dec, "trying default character encoding: %s", encoding); msg_Dbg (p_dec, "trying default character encoding: %s", encoding);
}
/* Check UTF-8 autodetection */
if (var_InheritBool (p_dec, "subsdec-autodetect-utf8")) if (var_InheritBool (p_dec, "subsdec-autodetect-utf8"))
{ {
msg_Dbg (p_dec, "using automatic UTF-8 detection"); msg_Dbg (p_dec, "using automatic UTF-8 detection");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment