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