Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitea7f964

Browse files
committed
Explicitly bind gettext() to the UTF8 locale when in use.
This is required on Windows due to the special localehandling for UTF8 that doesn't change the full environment.Fixes crash with translated error messages per bugs 4180and 4196.Tom Lane
1 parent7b8a63c commitea7f964

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

‎src/backend/utils/mb/mbutils.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* (currently mule internal code (mic) is used)
55
* Tatsuo Ishii
66
*
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 $
88
*/
99
#include"postgres.h"
1010

@@ -697,6 +697,25 @@ SetDatabaseEncoding(int encoding)
697697

698698
DatabaseEncoding=&pg_enc2name_tbl[encoding];
699699
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
700719
}
701720

702721
void

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp