vdr  2.0.6
iconpatch.c
Go to the documentation of this file.
1 #include "iconpatch.h"
2 
3 #include <langinfo.h>
4 #include <locale.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 
9 bool IsLangUtf8(void)
10 {
11  char *CodeSet = NULL;
12  if (setlocale(LC_CTYPE, ""))
13  CodeSet = nl_langinfo(CODESET);
14  else {
15  char *LangEnv = getenv("LANG"); // last resort in case locale stuff isn't installed
16  if (LangEnv) {
17  CodeSet = strchr(LangEnv, '.');
18  if (CodeSet)
19  CodeSet++; // skip the dot
20  }
21  }
22 
23  if (CodeSet && strcasestr(CodeSet, "UTF-8") != 0)
24  return true;
25 
26  return false;
27 }
bool IsLangUtf8(void)
Definition: iconpatch.c:9