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

Commit1f943dc

Browse files
committed
On Windows, if the encoding implied by locale is not allowed as a
server-encoding, fall back to UTF-8. It happens at least with the Chineselocale, which implies BIG5. This is safe, because on Windows all localesare compatible with UTF-8.
1 parent3affae5 commit1f943dc

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

‎src/bin/initdb/initdb.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2906,7 +2906,19 @@ main(int argc, char *argv[])
29062906
}
29072907
elseif (!pg_valid_server_encoding_id(ctype_enc))
29082908
{
2909-
/* We recognized it, but it's not a legal server encoding */
2909+
/*
2910+
* We recognized it, but it's not a legal server encoding.
2911+
* On Windows, UTF-8 works with any locale, so we can fall back
2912+
* to UTF-8.
2913+
*/
2914+
#ifdefWIN32
2915+
printf(_("Encoding %s implied by locale is not allowed as a server-side encoding.\n"
2916+
"The default database encoding will be set to %s instead.\n"),
2917+
pg_encoding_to_char(ctype_enc),
2918+
pg_encoding_to_char(PG_UTF8));
2919+
ctype_enc=PG_UTF8;
2920+
encodingid=encodingid_to_string(ctype_enc);
2921+
#else
29102922
fprintf(stderr,
29112923
_("%s: locale %s requires unsupported encoding %s\n"),
29122924
progname,lc_ctype,pg_encoding_to_char(ctype_enc));
@@ -2915,6 +2927,7 @@ main(int argc, char *argv[])
29152927
"Rerun %s with a different locale selection.\n"),
29162928
pg_encoding_to_char(ctype_enc),progname);
29172929
exit(1);
2930+
#endif
29182931
}
29192932
else
29202933
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp