18 #ifdef HAVE_LANGINFO_H
25 #if defined NO_LOCALE_CHARMAP
26 # error NO_LOCALE_CHARMAP defined
27 #elif defined _WIN32 || defined __CYGWIN__
28 const char *codeset = 0;
29 char cp[
sizeof(int) * 3 + 4];
35 UINT codepage = GetConsoleCP();
36 if (!codepage) codepage = GetACP();
37 snprintf(cp,
sizeof(cp),
"CP%d", codepage);
41 #elif defined HAVE_LANGINFO_H
43 codeset = nl_langinfo(CODESET);
54 #if defined NO_LOCALE_CHARMAP
55 # error NO_LOCALE_CHARMAP defined
56 #elif defined _WIN32 || defined __CYGWIN__
57 char cp[
sizeof(int) * 8 / 3 + 4];
58 snprintf(cp,
sizeof cp,
"CP%d", AreFileApisANSI() ? GetACP() : GetOEMCP());
60 if (idx < 0) idx = ENCINDEX_ASCII;