diff options
author | Tatsuo Ishii <ishii@postgresql.org> | 2000-11-17 04:25:29 +0000 |
---|---|---|
committer | Tatsuo Ishii <ishii@postgresql.org> | 2000-11-17 04:25:29 +0000 |
commit | 1350059d835fece487a842b6a64b4474ada82704 (patch) | |
tree | 3288b3cad3348ef715c04565b35fd31a8bdf6d45 | |
parent | f68b847504e219b31fb0d7d679f581f24e369b20 (diff) | |
download | postgresql-1350059d835fece487a842b6a64b4474ada82704.tar.gz |
Recongizing PGCLIENTENCODING has been broken since 7.0.
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 400bab2f7d..18771c0fea 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.127 2000/05/21 21:19:53 tgl Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.127.2.1 2000/11/17 04:25:29 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -1505,10 +1505,11 @@ keep_going: /* We will come back to here until there { const char *env; - /* query server encoding */ env = getenv(envname); if (!env || *env == '\0') { + /* query server encoding if PGCLIENTENCODING + is not specified */ if (!PQsendQuery(conn, "select getdatabaseencoding()")) goto error_return; @@ -1516,6 +1517,19 @@ keep_going: /* We will come back to here until there conn->setenv_state = SETENV_STATE_ENCODINGS_WAIT; return PGRES_POLLING_READING; } + else + { + /* otherwise set client encoding in pg_conn struct */ + int encoding = pg_char_to_encoding(env); + if (encoding < 0) + { + strcpy(conn->errorMessage.data, + "PGCLIENTENCODING has no valid encoding name.\n"); + goto error_return; + } + conn->client_encoding = encoding; + } + } case SETENV_STATE_ENCODINGS_WAIT: |