|
13 | 13 | *
|
14 | 14 | *
|
15 | 15 | * IDENTIFICATION
|
16 |
| - * $PostgreSQL: pgsql/src/backend/main/main.c,v 1.75 2004/03/05 01:11:04 momjian Exp $ |
| 16 | + * $PostgreSQL: pgsql/src/backend/main/main.c,v 1.76 2004/03/15 16:14:26 momjian Exp $ |
17 | 17 | *
|
18 | 18 | *-------------------------------------------------------------------------
|
19 | 19 | */
|
@@ -74,6 +74,10 @@ main(int argc, char *argv[])
|
74 | 74 | #endif /* NOPRINTADE */
|
75 | 75 | #endif /* __alpha */
|
76 | 76 |
|
| 77 | +#ifdef WIN32 |
| 78 | + char *env_locale; |
| 79 | +#endif |
| 80 | + |
77 | 81 | #if defined(NOFIXADE) || defined(NOPRINTADE)
|
78 | 82 |
|
79 | 83 | #if defined(ultrix4)
|
@@ -143,8 +147,30 @@ main(int argc, char *argv[])
|
143 | 147 | * set later during GUC option processing, but we set it here to allow
|
144 | 148 | * startup error messages to be localized.
|
145 | 149 | */
|
| 150 | + |
| 151 | +#ifdef WIN32 |
| 152 | + /* |
| 153 | + * Windows uses codepages rather than the environment, so we work around |
| 154 | + * that by querying the environment explicitly first for LC_COLLATE |
| 155 | + * and LC_CTYPE. We have to do this because initdb passes those values |
| 156 | + * in the environment. If there is nothing there we fall back on the |
| 157 | + * codepage. |
| 158 | + */ |
| 159 | + |
| 160 | + if ((env_locale = getenv("LC_COLLATE")) != NULL) |
| 161 | + setlocale(LC_COLLATE,env_locale); |
| 162 | + else |
| 163 | + setlocale(LC_COLLATE, ""); |
| 164 | + |
| 165 | + if ((env_locale = getenv("LC_CTYPE")) != NULL) |
| 166 | + setlocale(LC_CTYPE,env_locale); |
| 167 | + else |
| 168 | + setlocale(LC_CTYPE, ""); |
| 169 | +#else |
146 | 170 | setlocale(LC_COLLATE, "");
|
147 | 171 | setlocale(LC_CTYPE, "");
|
| 172 | +#endif |
| 173 | + |
148 | 174 | #ifdef LC_MESSAGES
|
149 | 175 | setlocale(LC_MESSAGES, "");
|
150 | 176 | #endif
|
|
0 commit comments