> > 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
This commit is contained in:
Bruce Momjian 2001-09-08 14:30:15 +00:00
parent 468b9d8202
commit fdbf796f36
1 changed files with 11 additions and 7 deletions

View File

@ -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;