[vlc-commits] subsdec: check UTF-8 autodetection if encoding is not known in ES format
KO Myung-Hun
git at videolan.org
Mon Nov 5 16:51:43 CET 2012
vlc | branch: master | KO Myung-Hun <komh at chollian.net> | Sat Oct 13 21:12:22 2012 +0900| [311af61b6dd27f6832e1c085a0e71c6eb6699c66] | committer: 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: Rémi Denis-Courmont <remi at remlab.net>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=311af61b6dd27f6832e1c085a0e71c6eb6699c66
---
modules/codec/subsdec.c | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/modules/codec/subsdec.c b/modules/codec/subsdec.c
index 118e901..5d935ea 100644
--- a/modules/codec/subsdec.c
+++ b/modules/codec/subsdec.c
@@ -262,23 +262,24 @@ static int OpenDecoder( vlc_object_t *p_this )
encoding);
}
else
- /* Second, try configured encoding */
- if ((var = var_InheritString (p_dec, "subsdec-encoding")) != NULL)
{
- msg_Dbg (p_dec, "trying configured character encoding: %s", var);
- if (!strcmp (var, "system"))
+ /* Second, try configured encoding */
+ if ((var = var_InheritString (p_dec, "subsdec-encoding")) != NULL)
{
- free (var);
- var = NULL;
- encoding = "";
- /* ^ iconv() treats "" as nl_langinfo(CODESET) */
+ msg_Dbg (p_dec, "trying configured character encoding: %s", var);
+ if (!strcmp (var, "system"))
+ {
+ free (var);
+ var = NULL;
+ encoding = "";
+ /* ^ iconv() treats "" as nl_langinfo(CODESET) */
+ }
+ else
+ encoding = var;
}
else
- encoding = var;
- }
- else
- /* Third, try "local" encoding with optional UTF-8 autodetection */
- {
+ /* Third, try "local" encoding */
+ {
/* xgettext:
The Windows ANSI code page most commonly used for this language.
VLC uses this as a guess of the subtitle files character set
@@ -289,8 +290,11 @@ static int OpenDecoder( vlc_object_t *p_this )
This MUST be a valid iconv character set. If unsure, please refer
the VideoLAN translators mailing list. */
- encoding = vlc_pgettext("GetACP", "CP1252");
- msg_Dbg (p_dec, "trying default character encoding: %s", encoding);
+ encoding = vlc_pgettext("GetACP", "CP1252");
+ msg_Dbg (p_dec, "trying default character encoding: %s", encoding);
+ }
+
+ /* Check UTF-8 autodetection */
if (var_InheritBool (p_dec, "subsdec-autodetect-utf8"))
{
msg_Dbg (p_dec, "using automatic UTF-8 detection");
More information about the vlc-commits
mailing list