Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit fdbf796

Browse files
committed
> > 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
1 parent 468b9d8 commit fdbf796

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/backend/utils/mb/mbutils.c

+11-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* client encoding and server internal encoding.
44
* (currently mule internal code (mic) is used)
55
* Tatsuo Ishii
6-
* $Id: mbutils.c,v 1.20 2001/09/06 04:57:29 ishii Exp $
6+
* $Id: mbutils.c,v 1.21 2001/09/08 14:30:15 momjian Exp $
77
*/
88
#include "postgres.h"
99

@@ -137,10 +137,9 @@ pg_get_client_encoding()
137137
Assert(DatabaseEncoding);
138138

139139
if (ClientEncoding == NULL)
140-
{
141140
/* this is the first time */
142141
ClientEncoding = DatabaseEncoding;
143-
}
142+
144143
return (ClientEncoding->encoding);
145144
}
146145

@@ -153,10 +152,9 @@ pg_get_client_encoding_name()
153152
Assert(DatabaseEncoding);
154153

155154
if (ClientEncoding == NULL)
156-
{
157155
/* this is the first time */
158156
ClientEncoding = DatabaseEncoding;
159-
}
157+
160158
return (ClientEncoding->name);
161159
}
162160

@@ -311,9 +309,12 @@ pg_convert2(PG_FUNCTION_ARGS)
311309
unsigned char *
312310
pg_client_to_server(unsigned char *s, int len)
313311
{
314-
Assert(ClientEncoding);
315312
Assert(DatabaseEncoding);
316313

314+
if (ClientEncoding == NULL)
315+
/* this is the first time */
316+
ClientEncoding = DatabaseEncoding;
317+
317318
if (ClientEncoding->encoding == DatabaseEncoding->encoding)
318319
return s;
319320

@@ -336,9 +337,12 @@ pg_client_to_server(unsigned char *s, int len)
336337
unsigned char *
337338
pg_server_to_client(unsigned char *s, int len)
338339
{
339-
Assert(ClientEncoding);
340340
Assert(DatabaseEncoding);
341341

342+
if (ClientEncoding == NULL)
343+
/* this is the first time */
344+
ClientEncoding = DatabaseEncoding;
345+
342346
if (ClientEncoding->encoding == DatabaseEncoding->encoding)
343347
return s;
344348

0 commit comments

Comments
 (0)