diff --git a/lib/client.js b/lib/client.js index d0052604..107377c7 100644 --- a/lib/client.js +++ b/lib/client.js @@ -40,11 +40,11 @@ var Client = function (config) { this.connection = c.connection || new Connection({ stream: c.stream, ssl: this.connectionParameters.ssl, - keepAlive: c.keepAlive || false + keepAlive: c.keepAlive || false, + encoding: this.connectionParameters.client_encoding || 'utf8' }) this.queryQueue = [] this.binary = c.binary || defaults.binary - this.encoding = 'utf8' this.processID = null this.secretKey = null this.ssl = this.connectionParameters.ssl || false diff --git a/lib/connection.js b/lib/connection.js index 2f13803e..0f98cb06 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -25,7 +25,7 @@ var Connection = function (config) { this.lastOffset = 0 this.buffer = null this.offset = null - this.encoding = 'utf8' + this.encoding = config.encoding || 'utf8' this.parsedStatements = {} this.writer = new Writer() this.ssl = config.ssl || false