Skip to content

Commit 860cccd

Browse files
ederavilapradobrianc
authored andcommitted
fix for server enconding when using SQL_ASCII and latin1 enconding
1 parent afe2498 commit 860cccd

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/client.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ var Client = function(config) {
3939
this.connection = c.connection || new Connection({
4040
stream: c.stream,
4141
ssl: this.connectionParameters.ssl,
42-
keepAlive: c.keepAlive || false
42+
keepAlive: c.keepAlive || false,
43+
client_encoding: this.connectionParameters.client_encoding || 'utf8',
4344
});
4445
this.queryQueue = [];
4546
this.binary = c.binary || defaults.binary;
46-
this.encoding = 'utf8';
47+
this.encoding = this.connectionParameters.client_encoding || 'utf8';
4748
this.processID = null;
4849
this.secretKey = null;
4950
this.ssl = this.connectionParameters.ssl || false;

lib/connection.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var Connection = function(config) {
3939
this.lastOffset = 0;
4040
this.buffer = null;
4141
this.offset = null;
42-
this.encoding = 'utf8';
42+
this.encoding = config.client_encoding || 'utf8';
4343
this.parsedStatements = {};
4444
this.writer = new Writer();
4545
this.ssl = config.ssl || false;

0 commit comments

Comments
 (0)