|
4 | 4 | * (currently mule internal code (mic) is used) |
5 | 5 | * Tatsuo Ishii |
6 | 6 | * |
7 | | - * $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.70 2008/04/12 23:21:04 tgl Exp $ |
| 7 | + * $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.71 2008/05/27 12:24:42 mha Exp $ |
8 | 8 | */ |
9 | 9 | #include"postgres.h" |
10 | 10 |
|
@@ -697,6 +697,25 @@ SetDatabaseEncoding(int encoding) |
697 | 697 |
|
698 | 698 | DatabaseEncoding=&pg_enc2name_tbl[encoding]; |
699 | 699 | Assert(DatabaseEncoding->encoding==encoding); |
| 700 | + |
| 701 | +/* |
| 702 | + * On Windows, we allow UTF-8 database encoding to be used with any |
| 703 | + * locale setting, because UTF-8 requires special handling anyway. |
| 704 | + * But this means that gettext() might be misled about what output |
| 705 | + * encoding it should use, so we have to tell it explicitly. |
| 706 | + * |
| 707 | + * In future we might want to call bind_textdomain_codeset |
| 708 | + * unconditionally, but that requires knowing how to spell the codeset |
| 709 | + * name properly for all encodings on all platforms, which might be |
| 710 | + * problematic. |
| 711 | + * |
| 712 | + * This is presently unnecessary, but harmless, on non-Windows platforms. |
| 713 | + */ |
| 714 | +#ifdefENABLE_NLS |
| 715 | +if (encoding==PG_UTF8) |
| 716 | +if (bind_textdomain_codeset("postgres","UTF-8")==NULL) |
| 717 | +elog(LOG,"bind_textdomain_codeset failed"); |
| 718 | +#endif |
700 | 719 | } |
701 | 720 |
|
702 | 721 | void |
|