aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2011-04-15 20:44:13 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2011-04-15 20:48:00 +0300
commit1f943dc8fe1377d93253fad9f01e4b0aa8599bbd (patch)
tree2e6858d965ef89ac3a370f41b1b0c2a9722af81d /src
parent3affae58b795fb238bed17c35cadcefabdc1f0ee (diff)
downloadpostgresql-1f943dc8fe1377d93253fad9f01e4b0aa8599bbd.tar.gz
postgresql-1f943dc8fe1377d93253fad9f01e4b0aa8599bbd.zip
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 Chinese locale, which implies BIG5. This is safe, because on Windows all locales are compatible with UTF-8.
Diffstat (limited to 'src')
-rw-r--r--src/bin/initdb/initdb.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index fd1f20ee862..f1b51bf870c 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -2906,7 +2906,19 @@ main(int argc, char *argv[])
}
else if (!pg_valid_server_encoding_id(ctype_enc))
{
- /* We recognized it, but it's not a legal server encoding */
+ /*
+ * We recognized it, but it's not a legal server encoding.
+ * On Windows, UTF-8 works with any locale, so we can fall back
+ * to UTF-8.
+ */
+#ifdef WIN32
+ printf(_("Encoding %s implied by locale is not allowed as a server-side encoding.\n"
+ "The default database encoding will be set to %s instead.\n"),
+ pg_encoding_to_char(ctype_enc),
+ pg_encoding_to_char(PG_UTF8));
+ ctype_enc = PG_UTF8;
+ encodingid = encodingid_to_string(ctype_enc);
+#else
fprintf(stderr,
_("%s: locale %s requires unsupported encoding %s\n"),
progname, lc_ctype, pg_encoding_to_char(ctype_enc));
@@ -2915,6 +2927,7 @@ main(int argc, char *argv[])
"Rerun %s with a different locale selection.\n"),
pg_encoding_to_char(ctype_enc), progname);
exit(1);
+#endif
}
else
{