File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 88 *
99 *
1010 * IDENTIFICATION
11- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.127 2000/05/21 21:19:53 tgl Exp $
11+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.127.2.1 2000/11/17 04:25:29 ishii Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -1505,17 +1505,31 @@ PQsetenvPoll(PGconn *conn)
15051505 {
15061506 const char * env ;
15071507
1508- /* query server encoding */
15091508 env = getenv (envname );
15101509 if (!env || * env == '\0' )
15111510 {
1511+ /* query server encoding if PGCLIENTENCODING
1512+ is not specified */
15121513 if (!PQsendQuery (conn ,
15131514 "select getdatabaseencoding()" ))
15141515 goto error_return ;
15151516
15161517 conn -> setenv_state = SETENV_STATE_ENCODINGS_WAIT ;
15171518 return PGRES_POLLING_READING ;
15181519 }
1520+ else
1521+ {
1522+ /* otherwise set client encoding in pg_conn struct */
1523+ int encoding = pg_char_to_encoding (env );
1524+ if (encoding < 0 )
1525+ {
1526+ strcpy (conn -> errorMessage .data ,
1527+ "PGCLIENTENCODING has no valid encoding name.\n" );
1528+ goto error_return ;
1529+ }
1530+ conn -> client_encoding = encoding ;
1531+ }
1532+
15191533 }
15201534
15211535 case SETENV_STATE_ENCODINGS_WAIT :
You can’t perform that action at this time.
0 commit comments