1313 *
1414 *
1515 * IDENTIFICATION
16- * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.201 2007/10/13 20:18:41 tgl Exp $
16+ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.202 2007/10/16 11:30:16 mha Exp $
1717 *
1818 *-------------------------------------------------------------------------
1919 */
@@ -258,7 +258,7 @@ createdb(const CreatedbStmt *stmt)
258258
259259/*
260260 * Check whether encoding matches server locale settings. We allow
261- * mismatch intwo cases:
261+ * mismatch inthree cases:
262262 *
263263 * 1. ctype_encoding = SQL_ASCII, which means either that the locale
264264 * is C/POSIX which works with any encoding, or that we couldn't determine
@@ -268,12 +268,19 @@ createdb(const CreatedbStmt *stmt)
268268 * This is risky but we have historically allowed it --- notably, the
269269 * regression tests require it.
270270 *
271+ * 3. selected encoding is UTF8 and platform is win32. This is because
272+ * UTF8 is a pseudo codepage that is supported in all locales since
273+ * it's converted to UTF16 before being used.
274+ *
271275 * Note: if you change this policy, fix initdb to match.
272276 */
273277ctype_encoding = pg_get_encoding_from_locale (NULL );
274278
275279if (!(ctype_encoding == encoding ||
276280ctype_encoding == PG_SQL_ASCII ||
281+ #ifdef WIN32
282+ encoding == PG_UTF8 ||
283+ #endif
277284 (encoding == PG_SQL_ASCII && superuser ())))
278285ereport (ERROR ,
279286(errmsg ("encoding %s does not match server's locale %s" ,