[vlc-commits] commit: subsdec: add a special "local system" character set ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Sat Aug 21 11:30:31 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Aug 21 12:29:58 2010 +0300| [303d8ea42d8c416683ceba4b9002e67bc022a648] | committer: Rémi Denis-Courmont 

subsdec: add a special "local system" character set

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=303d8ea42d8c416683ceba4b9002e67bc022a648
---

 modules/codec/subtitles/subsdec.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/modules/codec/subtitles/subsdec.c b/modules/codec/subtitles/subsdec.c
index c49e8f1..b128859 100644
--- a/modules/codec/subtitles/subsdec.c
+++ b/modules/codec/subtitles/subsdec.c
@@ -51,6 +51,7 @@ static char           *CreateHtmlSubtitle( int *pi_align, char * );
  *****************************************************************************/
 static const char *const ppsz_encodings[] = {
     "",
+    "system",
     "UTF-8",
     "UTF-16",
     "UTF-16BE",
@@ -99,6 +100,7 @@ static const char *const ppsz_encoding_names[] = {
       the GetACP translation. "Windows-1252" applies to Western European
       languages using the Latin alphabet. */
     N_("Default (Windows-1252)"),
+    N_("System codeset"),
     N_("Universal (UTF-8)"),
     N_("Universal (UTF-16)"),
     N_("Universal (big endian UTF-16)"),
@@ -282,6 +284,12 @@ static int OpenDecoder( vlc_object_t *p_this )
         psz_charset = var_InheritString (p_dec, "subsdec-encoding");
         msg_Dbg (p_dec, "trying configured character encoding: %s",
                  psz_charset ? psz_charset : "not specified");
+        if (!strcmp (psz_charset, "system"))
+        {
+            free (psz_charset);
+            psz_charset = strdup ("");
+            /* ^ iconv() treats "" as nl_langinfo(CODESET) */
+        }
     }
 
     /* Third, try "local" encoding with optional UTF-8 autodetection */



More information about the vlc-commits mailing list