[vlc-devel] [PATCH] subsdec: check UTF-8 autodetection all the time

KO Myung-Hun komh78 at gmail.com
Tue Oct 30 11:17:40 CET 2012


Ping ?

KO Myung-Hun wrote:
> Sorry, use this.
> 
> 
> 
> 
> 0002-subsdec-check-UTF-8-autodetection-if-encoding-is-not.patch
> 
> 
> From 7aa8ee06a1166fb419843b553de637b34a67d842 Mon Sep 17 00:00:00 2001
> From: KO Myung-Hun <komh at chollian.net>
> Date: Sat, 13 Oct 2012 21:12:22 +0900
> Subject: [PATCH 2/3] 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.
> ---
>  modules/codec/subsdec.c |   34 +++++++++++++++++++---------------
>  1 files 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");
> 
> 
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.22 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr




More information about the vlc-devel mailing list