*** src/port/chklocale.c.orig Wed Oct 3 10:50:57 2007 --- src/port/chklocale.c Wed Oct 3 11:27:54 2007 *************** *** 27,34 **** #include "mb/pg_wchar.h" - #if defined(HAVE_LANGINFO_H) && defined(CODESET) - /* * This table needs to recognize all the CODESET spellings for supported * backend encodings, as well as frontend-only encodings where possible --- 27,32 ---- *************** *** 143,148 **** --- 141,147 ---- {PG_SJIS, "SJIS"}, {PG_SJIS, "PCK"}, + {PG_SJIS, "CP932"}, {PG_BIG5, "BIG5"}, {PG_BIG5, "BIG5HKSCS"}, *************** *** 160,165 **** --- 159,165 ---- {PG_SQL_ASCII, NULL} /* end marker */ }; + #if defined(HAVE_LANGINFO_H) && defined(CODESET) /* * Given a setting for LC_CTYPE, return the Postgres ID of the associated *************** *** 276,282 **** --- 276,300 ---- int pg_get_encoding_from_locale(const char *ctype) { + #ifndef WIN32 return PG_SQL_ASCII; + #else + int i; + char sys[32]; + + snprintf(sys, sizeof(sys), "CP%u", GetACP()); + + /* Check the table */ + for (i = 0; encoding_match_list[i].system_enc_name; i++) + { + if (pg_strcasecmp(sys, encoding_match_list[i].system_enc_name) == 0) + { + return encoding_match_list[i].pg_enc_code; + } + } + + return PG_SQL_ASCII; + #endif } #endif /* HAVE_LANGINFO_H && CODESET */