Index: mbutils.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/utils/mb/mbutils.c,v retrieving revision 1.70 diff -c -r1.70 mbutils.c *** mbutils.c 12 Apr 2008 23:21:04 -0000 1.70 --- mbutils.c 26 May 2008 17:15:49 -0000 *************** *** 697,702 **** --- 697,721 ---- 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