Index: src/backend/main/main.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/main/main.c,v retrieving revision 1.75 diff -c -r1.75 main.c *** src/backend/main/main.c 5 Mar 2004 01:11:04 -0000 1.75 --- src/backend/main/main.c 12 Mar 2004 16:27:13 -0000 *************** *** 74,79 **** --- 74,83 ---- #endif /* NOPRINTADE */ #endif /* __alpha */ + #ifdef WIN32 + char *env_locale; + #endif + #if defined(NOFIXADE) || defined(NOPRINTADE) #if defined(ultrix4) *************** *** 143,150 **** --- 147,176 ---- * set later during GUC option processing, but we set it here to allow * startup error messages to be localized. */ + + #ifdef WIN32 + /* + * Windows uses codepages rather than the environment, so we work around + * that by querying the environment explicitly first for LC_COLLATE + * and LC_CTYPE. We have to do this because initdb passes those values + * in the environment. If there is nothing there we fall back on the + * codepage. + */ + + if ((env_locale = getenv("LC_COLLATE")) != NULL) + setlocale(LC_COLLATE,env_locale); + else + setlocale(LC_COLLATE, ""); + + if ((env_locale = getenv("LC_CTYPE")) != NULL) + setlocale(LC_CTYPE,env_locale); + else + setlocale(LC_CTYPE, ""); + #else setlocale(LC_COLLATE, ""); setlocale(LC_CTYPE, ""); + #endif + #ifdef LC_MESSAGES setlocale(LC_MESSAGES, ""); #endif