reverted binary->utf8

This commit is contained in:
Andris Reinman 2017-03-20 16:45:33 +02:00
parent a0851a93c0
commit d77a8a7a7e
4 changed files with 6 additions and 7 deletions

View file

@ -41,4 +41,3 @@ transporter.sendMail({
console.log(info); console.log(info);
} }
}); });
}

View file

@ -28,7 +28,7 @@ module.exports = function (response, isLogging) {
maxLength = maxLength || 0; maxLength = maxLength || 0;
if (resp.length) { if (resp.length) {
queue.push(new Buffer(resp)); queue.push(Buffer.from(resp, 'binary'));
lr = resp; lr = resp;
resp = ''; resp = '';
} }
@ -88,7 +88,7 @@ module.exports = function (response, isLogging) {
} else if (typeof value !== 'string') { } else if (typeof value !== 'string') {
value = (value || '').toString(); value = (value || '').toString();
} }
output.write(new Buffer(value)); output.write(Buffer.from(value, 'binary'));
return emit(); return emit();
} }
}; };

View file

@ -118,7 +118,7 @@ class IMAPConnection extends EventEmitter {
*/ */
send(payload, callback) { send(payload, callback) {
if (this._socket && this._socket.writable) { if (this._socket && this._socket.writable) {
this._socket.write(payload + '\r\n', 'utf-8', callback); this._socket.write(payload + '\r\n', 'binary', callback);
this._server.logger.debug('[%s] S:', this.id, payload); this._server.logger.debug('[%s] S:', this.id, payload);
} }
} }

View file

@ -50,7 +50,7 @@ class Indexer {
data = data.join('\r\n'); data = data.join('\r\n');
} }
if (data || force) { if (data || force) {
size += new Buffer((first ? '' : '\r\n') + (data || ''), 'binary').length; size += Buffer.from((first ? '' : '\r\n') + (data || ''), 'binary').length;
first = false; first = false;
} }
}; };
@ -126,7 +126,7 @@ class Indexer {
data = data.join('\r\n'); data = data.join('\r\n');
} }
if (remainder || data || force) { if (remainder || data || force) {
res.write(new Buffer((first ? '' : '\r\n') + (remainder || '') + (data || ''), 'binary')); res.write(Buffer.from((first ? '' : '\r\n') + (remainder || '') + (data || ''), 'binary'));
first = false; first = false;
} }
remainder = ''; remainder = '';
@ -423,7 +423,7 @@ class Indexer {
}); });
} else { } else {
return setImmediate(() => callback(null, new Buffer((data || '').toString(), 'binary'))); return setImmediate(() => callback(null, Buffer.from((data || '').toString(), 'binary')));
} }
} }