]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvr: Try to autodetect the UTF-8 filesystem charset
authorJaroslav Kysela <perex@perex.cz>
Wed, 28 May 2014 17:27:15 +0000 (19:27 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 28 May 2014 17:27:15 +0000 (19:27 +0200)
src/dvr/dvr_db.c
src/intlconv.c
src/intlconv.h

index 359c010fd49ff732cb9f0db9653ad4145402c417..71c976257a4195ffa2e94b87f2b4c4cf89233a80 100644 (file)
@@ -174,7 +174,7 @@ dvr_charset_update(dvr_config_t *cfg, const char *charset)
 
   free(cfg->dvr_charset);
   free(cfg->dvr_charset_id);
-  s = charset ? charset : "ASCII";
+  s = charset ? charset : intlconv_filesystem_charset();
   id = intlconv_charset_id(s, 1, 1);
   cfg->dvr_charset = strdup(s);
   cfg->dvr_charset_id = id ? strdup(id) : NULL;
index cfea4f2118ba31ff343931a5245f7413c0e86b97..46df126ec5c07a798c807ae87c29e4cf65ade7c7 100644 (file)
@@ -34,6 +34,16 @@ intlconv_done( void )
   pthread_mutex_unlock(&intlconv_lock);
 }
 
+const char *
+intlconv_filesystem_charset( void )
+{
+  char *s = getenv("LANG");
+  if (s && strstr(s, ".utf8"))
+    return NULL;
+  /* be safe here */
+  return "ASCII";
+}
+
 static int
 intlconv_cmp ( intlconv_cache_t *a, intlconv_cache_t *b )
 {
index 54dd987ad129bc29af996bc9f4213b24b37e8342..1b57f6e0a91b581f26df067e99eee957e74009ae 100644 (file)
@@ -23,6 +23,8 @@ extern const char *intlconv_charsets[];
 
 void intlconv_init( void );
 void intlconv_done( void );
+const char *
+intlconv_filesystem_charset( void );
 char *
 intlconv_charset_id( const char *charset,
                      int transil,