提交 fdbf796f 编写于 作者: B Bruce Momjian

> > A simple and robus solution is in the begin of mbutils.c set default

> > ClientEncoding to SQL_ASCII (like default DatabaseEncoding). Bruce, can
> > you change it? It's one line change. Again thanks.

 Forget it! A default client encoding must be set by actual database encoding...
Please apply the small attached patch that solve it better.

Karel Zak
上级 468b9d82
......@@ -3,7 +3,7 @@
* client encoding and server internal encoding.
* (currently mule internal code (mic) is used)
* Tatsuo Ishii
* $Id: mbutils.c,v 1.20 2001/09/06 04:57:29 ishii Exp $
* $Id: mbutils.c,v 1.21 2001/09/08 14:30:15 momjian Exp $
*/
#include "postgres.h"
......@@ -137,10 +137,9 @@ pg_get_client_encoding()
Assert(DatabaseEncoding);
if (ClientEncoding == NULL)
{
/* this is the first time */
ClientEncoding = DatabaseEncoding;
}
return (ClientEncoding->encoding);
}
......@@ -153,10 +152,9 @@ pg_get_client_encoding_name()
Assert(DatabaseEncoding);
if (ClientEncoding == NULL)
{
/* this is the first time */
ClientEncoding = DatabaseEncoding;
}
return (ClientEncoding->name);
}
......@@ -311,9 +309,12 @@ pg_convert2(PG_FUNCTION_ARGS)
unsigned char *
pg_client_to_server(unsigned char *s, int len)
{
Assert(ClientEncoding);
Assert(DatabaseEncoding);
if (ClientEncoding == NULL)
/* this is the first time */
ClientEncoding = DatabaseEncoding;
if (ClientEncoding->encoding == DatabaseEncoding->encoding)
return s;
......@@ -336,9 +337,12 @@ pg_client_to_server(unsigned char *s, int len)
unsigned char *
pg_server_to_client(unsigned char *s, int len)
{
Assert(ClientEncoding);
Assert(DatabaseEncoding);
if (ClientEncoding == NULL)
/* this is the first time */
ClientEncoding = DatabaseEncoding;
if (ClientEncoding->encoding == DatabaseEncoding->encoding)
return s;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册