summaryrefslogtreecommitdiff
path: root/vdr.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2007-06-15 13:25:35 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2007-06-15 13:25:35 +0200
commitd1934a7cfd99abbf9502aef6e6ecd897f78aa026 (patch)
treeaf6b6e87662b5fab8265ff5b95a03614ac9f8301 /vdr.c
parent1f7c70cd49046525519cc84cb118d246c71569dc (diff)
downloadvdr-d1934a7cfd99abbf9502aef6e6ecd897f78aa026.tar.gz
vdr-d1934a7cfd99abbf9502aef6e6ecd897f78aa026.tar.bz2
Using nl_langinfo(CODESET) to determine the local codeset to use; libsi uses canonical codeset names
Diffstat (limited to 'vdr.c')
-rw-r--r--vdr.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/vdr.c b/vdr.c
index f7ff1b58..f3218eb2 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,11 +22,12 @@
*
* The project's page is at http://www.cadsoft.de/vdr
*
- * $Id: vdr.c 1.291 2007/06/09 12:33:53 kls Exp $
+ * $Id: vdr.c 1.292 2007/06/15 13:20:34 kls Exp $
*/
#include <getopt.h>
#include <grp.h>
+#include <langinfo.h>
#include <locale.h>
#include <pwd.h>
#include <signal.h>
@@ -493,18 +494,22 @@ int main(int argc, char *argv[])
// Set the system character table:
- char *LangEnv = setlocale(LC_CTYPE, "");
- if (!LangEnv)
- LangEnv = getenv("LANG"); // last resort in case locale stuff isn't installed
- if (LangEnv) {
- char *CodeSet = strchr(LangEnv, '.');
- if (CodeSet) {
- CodeSet++; // skip the dot
- bool known = SI::SetSystemCharacterTable(CodeSet);
- isyslog("codeset is '%s' - %s", CodeSet, known ? "known" : "unknown");
- cCharSetConv::SetSystemCharacterTable(CodeSet);
+ char *CodeSet = NULL;
+ if (setlocale(LC_CTYPE, ""))
+ CodeSet = nl_langinfo(CODESET);
+ else {
+ char *LangEnv = getenv("LANG"); // last resort in case locale stuff isn't installed
+ if (LangEnv) {
+ CodeSet = strchr(LangEnv, '.');
+ if (CodeSet)
+ CodeSet++; // skip the dot
}
}
+ if (CodeSet) {
+ bool known = SI::SetSystemCharacterTable(CodeSet);
+ isyslog("codeset is '%s' - %s", CodeSet, known ? "known" : "unknown");
+ cCharSetConv::SetSystemCharacterTable(CodeSet);
+ }
// Main program loop variables - need to be here to have them initialized before any EXIT():