51a52,53 > static char *pg_encoding_to_char(int encoding); > static void _doSetClientEncoding(ArchiveHandle *AH, const char *encoding); 203a206,211 > * Store current client encoding > */ > > _doSetClientEncoding(AH, pg_encoding_to_char(PQclientEncoding(AH->connection))); > > /* 1951a1960,1992 > static void > _doSetClientEncoding(ArchiveHandle *AH, const char *encoding) > { > PQExpBuffer cmd = createPQExpBuffer(); > > appendPQExpBuffer(cmd, "SET client_encoding TO "); > > /* > * SQL requires a string literal here. Might as well be correct. > */ > if (encoding && *encoding) > appendStringLiteral(cmd, encoding, false); > else > appendPQExpBuffer(cmd, "DEFAULT"); > appendPQExpBuffer(cmd, ";"); > > if (RestoringToDB(AH)) > { > PGresult *res; > > res = PQexec(AH->connection, cmd->data); > > if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) > die_horribly(AH, modulename, "could not client encoding to \"%s\": %s", > encoding, PQerrorMessage(AH->connection)); > > PQclear(res); > } > else > ahprintf(AH, "%s\n\n", cmd->data); > > destroyPQExpBuffer(cmd); > }