Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
5841aa86
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5841aa86
编写于
1月 22, 2009
作者:
M
Magnus Hagander
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Explicitly bind gettext to the correct encoding on Windows.
Original patch from Hiroshi Inoue.
上级
95aaf25f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
57 addition
and
16 deletion
+57
-16
src/backend/utils/mb/mbutils.c
src/backend/utils/mb/mbutils.c
+57
-16
未找到文件。
src/backend/utils/mb/mbutils.c
浏览文件 @
5841aa86
...
...
@@ -4,7 +4,7 @@
* (currently mule internal code (mic) is used)
* Tatsuo Ishii
*
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.7
7 2009/01/19 15:34:23
mha Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.7
8 2009/01/22 10:09:48
mha Exp $
*/
#include "postgres.h"
...
...
@@ -849,6 +849,46 @@ cliplen(const char *str, int len, int limit)
return
l
;
}
#if defined(ENABLE_NLS) && defined(WIN32)
static
const
struct
codeset_map
{
int
encoding
;
const
char
*
codeset
;
}
codeset_map_array
[]
=
{
{
PG_UTF8
,
"UTF-8"
},
{
PG_LATIN1
,
"LATIN1"
},
{
PG_LATIN2
,
"LATIN2"
},
{
PG_LATIN3
,
"LATIN3"
},
{
PG_LATIN4
,
"LATIN4"
},
{
PG_ISO_8859_5
,
"ISO-8859-5"
},
{
PG_ISO_8859_6
,
"ISO_8859-6"
},
{
PG_ISO_8859_7
,
"ISO-8859-7"
},
{
PG_ISO_8859_8
,
"ISO-8859-8"
},
{
PG_LATIN5
,
"LATIN5"
},
{
PG_LATIN6
,
"LATIN6"
},
{
PG_LATIN7
,
"LATIN7"
},
{
PG_LATIN8
,
"LATIN8"
},
{
PG_LATIN9
,
"LATIN-9"
},
{
PG_LATIN10
,
"LATIN10"
},
{
PG_KOI8R
,
"KOI8-R"
},
{
PG_WIN1250
,
"CP1250"
},
{
PG_WIN1251
,
"CP1251"
},
{
PG_WIN1252
,
"CP1252"
},
{
PG_WIN1253
,
"CP1253"
},
{
PG_WIN1254
,
"CP1254"
},
{
PG_WIN1255
,
"CP1255"
},
{
PG_WIN1256
,
"CP1256"
},
{
PG_WIN1257
,
"CP1257"
},
{
PG_WIN1258
,
"CP1258"
},
{
PG_WIN866
,
"CP866"
},
{
PG_WIN874
,
"CP874"
},
{
PG_EUC_CN
,
"EUC-CN"
},
{
PG_EUC_JP
,
"EUC-JP"
},
{
PG_EUC_KR
,
"EUC-KR"
},
{
PG_EUC_TW
,
"EUC-TW"
},
{
PG_EUC_JIS_2004
,
"EUC-JP"
}
};
#endif
/* WIN32 */
void
SetDatabaseEncoding
(
int
encoding
)
{
...
...
@@ -859,22 +899,23 @@ SetDatabaseEncoding(int 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.
* On Windows, we need to explicitly bind gettext to the correct
* encoding, because gettext() tends to get confused.
*/
#ifdef ENABLE_NLS
if
(
encoding
==
PG_UTF8
)
if
(
bind_textdomain_codeset
(
textdomain
(
NULL
),
"UTF-8"
)
==
NULL
)
elog
(
LOG
,
"bind_textdomain_codeset failed"
);
#if defined(ENABLE_NLS) && defined(WIN32)
{
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
codeset_map_array
)
/
sizeof
(
codeset_map_array
[
0
]);
i
++
)
{
if
(
codeset_map_array
[
i
].
encoding
==
encoding
)
{
if
(
bind_textdomain_codeset
(
textdomain
(
NULL
),
codeset_map_array
[
i
].
codeset
)
==
NULL
)
elog
(
LOG
,
"bind_textdomain_codeset failed"
);
break
;
}
}
}
#endif
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录