force utf-8 encoding on connect

This commit is contained in:
Arkady Emelyanov 2013-01-26 16:36:09 +04:00 committed by bmc
parent 2e66497511
commit 4c254e8edf
3 changed files with 5 additions and 0 deletions

View File

@ -61,6 +61,7 @@ ConnectionParameters.prototype.getLibpqConnectionString = function(cb) {
params.push("host=" + this.getDomainSocketName());
return cb(null, params.join(' '));
}
params.push("options=--client_encoding='utf-8'");
dns.lookup(this.host, function(err, address) {
if(err) return cb(err, null);
params.push("hostaddr=" + address);

View File

@ -116,6 +116,8 @@ p.startup = function(config) {
.addCString(config.user)
.addCString('database')
.addCString(config.database)
.addCString('options')
.addCString("--client_encoding='utf-8'")
.addCString('').flush();
//this message is sent without a code

View File

@ -23,6 +23,8 @@ test("sends startup message", function() {
.addCString('brian')
.addCString('database')
.addCString('bang')
.addCString('options')
.addCString("--client_encoding='utf-8'")
.addCString('').join(true))
});