Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdea47ee

Browse files
committed
Windows uses codepages rather than the environment, so we work around
that by querying the environment explicitly first for LC_COLLATE andLC_CTYPE. We have to do this because initdb passes those values in theenvironment. If there is nothing there we fall back on the codepage.Andrew Dunstan
1 parent221c0ad commitdea47ee

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

‎src/backend/main/main.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* 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 $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -74,6 +74,10 @@ main(int argc, char *argv[])
7474
#endif/* NOPRINTADE */
7575
#endif/* __alpha */
7676

77+
#ifdefWIN32
78+
char*env_locale;
79+
#endif
80+
7781
#if defined(NOFIXADE)|| defined(NOPRINTADE)
7882

7983
#if defined(ultrix4)
@@ -143,8 +147,30 @@ main(int argc, char *argv[])
143147
* set later during GUC option processing, but we set it here to allow
144148
* startup error messages to be localized.
145149
*/
150+
151+
#ifdefWIN32
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
146170
setlocale(LC_COLLATE,"");
147171
setlocale(LC_CTYPE,"");
172+
#endif
173+
148174
#ifdefLC_MESSAGES
149175
setlocale(LC_MESSAGES,"");
150176
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp