> > 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:
parent
468b9d8202
commit
fdbf796f36
@ -3,7 +3,7 @@
|
|||||||
* client encoding and server internal encoding.
|
* client encoding and server internal encoding.
|
||||||
* (currently mule internal code (mic) is used)
|
* (currently mule internal code (mic) is used)
|
||||||
* Tatsuo Ishii
|
* 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"
|
#include "postgres.h"
|
||||||
|
|
||||||
@ -137,10 +137,9 @@ pg_get_client_encoding()
|
|||||||
Assert(DatabaseEncoding);
|
Assert(DatabaseEncoding);
|
||||||
|
|
||||||
if (ClientEncoding == NULL)
|
if (ClientEncoding == NULL)
|
||||||
{
|
|
||||||
/* this is the first time */
|
/* this is the first time */
|
||||||
ClientEncoding = DatabaseEncoding;
|
ClientEncoding = DatabaseEncoding;
|
||||||
}
|
|
||||||
return (ClientEncoding->encoding);
|
return (ClientEncoding->encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,10 +152,9 @@ pg_get_client_encoding_name()
|
|||||||
Assert(DatabaseEncoding);
|
Assert(DatabaseEncoding);
|
||||||
|
|
||||||
if (ClientEncoding == NULL)
|
if (ClientEncoding == NULL)
|
||||||
{
|
|
||||||
/* this is the first time */
|
/* this is the first time */
|
||||||
ClientEncoding = DatabaseEncoding;
|
ClientEncoding = DatabaseEncoding;
|
||||||
}
|
|
||||||
return (ClientEncoding->name);
|
return (ClientEncoding->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,9 +309,12 @@ pg_convert2(PG_FUNCTION_ARGS)
|
|||||||
unsigned char *
|
unsigned char *
|
||||||
pg_client_to_server(unsigned char *s, int len)
|
pg_client_to_server(unsigned char *s, int len)
|
||||||
{
|
{
|
||||||
Assert(ClientEncoding);
|
|
||||||
Assert(DatabaseEncoding);
|
Assert(DatabaseEncoding);
|
||||||
|
|
||||||
|
if (ClientEncoding == NULL)
|
||||||
|
/* this is the first time */
|
||||||
|
ClientEncoding = DatabaseEncoding;
|
||||||
|
|
||||||
if (ClientEncoding->encoding == DatabaseEncoding->encoding)
|
if (ClientEncoding->encoding == DatabaseEncoding->encoding)
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
@ -336,9 +337,12 @@ pg_client_to_server(unsigned char *s, int len)
|
|||||||
unsigned char *
|
unsigned char *
|
||||||
pg_server_to_client(unsigned char *s, int len)
|
pg_server_to_client(unsigned char *s, int len)
|
||||||
{
|
{
|
||||||
Assert(ClientEncoding);
|
|
||||||
Assert(DatabaseEncoding);
|
Assert(DatabaseEncoding);
|
||||||
|
|
||||||
|
if (ClientEncoding == NULL)
|
||||||
|
/* this is the first time */
|
||||||
|
ClientEncoding = DatabaseEncoding;
|
||||||
|
|
||||||
if (ClientEncoding->encoding == DatabaseEncoding->encoding)
|
if (ClientEncoding->encoding == DatabaseEncoding->encoding)
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user