aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/mb/mbutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/mb/mbutils.c')
-rw-r--r--src/backend/utils/mb/mbutils.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/backend/utils/mb/mbutils.c b/src/backend/utils/mb/mbutils.c
index cd1ee00c10a..83e3a11c38f 100644
--- a/src/backend/utils/mb/mbutils.c
+++ b/src/backend/utils/mb/mbutils.c
@@ -4,7 +4,7 @@
* (currently mule internal code (mic) is used)
* Tatsuo Ishii
*
- * $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.70 2008/04/12 23:21:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.71 2008/05/27 12:24:42 mha Exp $
*/
#include "postgres.h"
@@ -697,6 +697,25 @@ SetDatabaseEncoding(int encoding)
DatabaseEncoding = &pg_enc2name_tbl[encoding];
Assert(DatabaseEncoding->encoding == encoding);
+
+ /*
+ * On Windows, we allow UTF-8 database encoding to be used with any
+ * locale setting, because UTF-8 requires special handling anyway.
+ * But this means that gettext() might be misled about what output
+ * encoding it should use, so we have to tell it explicitly.
+ *
+ * In future we might want to call bind_textdomain_codeset
+ * unconditionally, but that requires knowing how to spell the codeset
+ * name properly for all encodings on all platforms, which might be
+ * problematic.
+ *
+ * This is presently unnecessary, but harmless, on non-Windows platforms.
+ */
+#ifdef ENABLE_NLS
+ if (encoding == PG_UTF8)
+ if (bind_textdomain_codeset("postgres", "UTF-8") == NULL)
+ elog(LOG, "bind_textdomain_codeset failed");
+#endif
}
void