17 #ifdef HAVE_LANGINFO_H 21 #if defined _WIN32 || defined __CYGWIN__ 22 #define SIZEOF_CP_NAME ((sizeof(UINT) * 8 / 3) + 4) 23 #define CP_FORMAT(buf, codepage) snprintf(buf, sizeof(buf), "CP%u", (codepage)) 25 extern UINT ruby_w32_codepage[2];
28 #ifndef NO_LOCALE_CHARMAP 29 # if defined _WIN32 || defined __CYGWIN__ || defined HAVE_LANGINFO_H 30 # define NO_LOCALE_CHARMAP 0 32 # define NO_LOCALE_CHARMAP 1 36 #if !NO_LOCALE_CHARMAP 38 locale_charmap(
VALUE (*conv)(
const char *))
40 const char *codeset = 0;
41 #if defined _WIN32 || defined __CYGWIN__ 42 char cp[SIZEOF_CP_NAME];
48 UINT codepage = ruby_w32_codepage[0];
49 if (!codepage) codepage = GetConsoleCP();
50 if (!codepage) codepage = GetACP();
51 CP_FORMAT(cp, codepage);
54 #elif defined HAVE_LANGINFO_H 55 codeset = nl_langinfo(CODESET);
58 # error locale_charmap() is not implemented 60 return (*conv)(codeset);
99 #if !NO_LOCALE_CHARMAP 101 enc_find_index(
const char *
name)
110 #if NO_LOCALE_CHARMAP 113 return (
int)locale_charmap(enc_find_index);
121 #if NO_LOCALE_CHARMAP 124 char cp[SIZEOF_CP_NAME];
125 const UINT codepage = ruby_w32_codepage[1] ? ruby_w32_codepage[1] :
126 AreFileApisANSI() ? GetACP() : GetOEMCP();
127 CP_FORMAT(cp, codepage);
130 #elif defined __CYGWIN__ #define ENCINDEX_US_ASCII
const char * nl_langinfo_codeset(void)
rb_encoding * rb_default_external_encoding(void)
int rb_enc_to_index(rb_encoding *enc)
int rb_locale_charmap_index(void)
VALUE rb_locale_charmap(VALUE klass)
int Init_enc_set_filesystem_encoding(void)
int rb_enc_find_index(const char *name)
VALUE rb_usascii_str_new_cstr(const char *)