Permalink
Browse files

Fix Unicode handling interop with other clients.

Fixes #31
  • Loading branch information...
legastero committed Aug 5, 2014
1 parent 04e1904 commit 937e674f2cf551dda50fac49d4e13f5a899c6143
Showing with 9 additions and 9 deletions.
  1. +4 −0 CHANGELOG.md
  2. +1 −2 lib/plugins/disco.js
  3. +2 −3 lib/transports/bosh.js
  4. +2 −3 lib/transports/websocket.js
  5. +0 −1 package.json
View
@@ -1,5 +1,9 @@
# Change Log
## 6.0.0 -> 6.0.1
* **Bug Fixes**
* [#31: Resolve Unicode interop with other clients](https://github.com/otalk/stanza.io/issues/31)
## 5.x.x -> 6.0.0
* **Breaking Changes**
* Removed `client.call()`
View
@@ -1,7 +1,6 @@
'use strict';
var _ = require('underscore');
var utf8 = require('utf8');
var hashes = require('iana-hashes');
require('../stanza/disco');
@@ -90,7 +89,7 @@ function generateVerString(info, hash) {
});
});
var ver = hashes.createHash(hash).update(new Buffer(utf8.encode(S))).digest('base64');
var ver = hashes.createHash(hash).update(new Buffer(S, 'utf8')).digest('base64');
var padding = 4 - ver.length % 4;
if (padding === 4) {
padding = 0;
View
@@ -2,7 +2,6 @@
var _ = require('underscore');
var util = require('util');
var utf8 = require('utf8');
var Promise = require('bluebird');
var request = Promise.promisify(require('request'));
@@ -194,7 +193,7 @@ BOSHConnection.prototype.request = function (bosh) {
bosh.rid = self.rid;
bosh.sid = self.sid;
var body = new Buffer(utf8.encode(bosh.toString())).toString();
var body = new Buffer(bosh.toString(), 'utf8').toString();
self.emit('raw:outgoing', body);
@@ -210,7 +209,7 @@ BOSHConnection.prototype.request = function (bosh) {
ticket.request = req;
return req.then(function (body) {
self.emit('raw:incoming', new Buffer(utf8.decode(body)).toString());
self.emit('raw:incoming', new Buffer(body, 'utf8').toString());
}).catch(ConnectionError, function (err) {
self.hasStream = false;
var serr = new StreamError({
@@ -1,7 +1,6 @@
'use strict';
var util = require('util');
var utf8 = require('utf8');
var stanza = require('jxt');
var WildEmitter = require('wildemitter');
var async = require('async');
@@ -30,7 +29,7 @@ function WSConnection(sm) {
data = data.toString();
}
data = new Buffer(utf8.encode(data)).toString();
data = new Buffer(data, 'utf8').toString();
self.emit('raw:outgoing', data);
if (self.conn.readyState === WS_OPEN) {
@@ -107,7 +106,7 @@ WSConnection.prototype.connect = function (opts) {
};
self.conn.onmessage = function (wsMsg) {
self.emit('raw:incoming', new Buffer(utf8.decode(wsMsg.data)).toString());
self.emit('raw:incoming', new Buffer(wsMsg.data, 'utf8').toString());
};
};
View
@@ -36,7 +36,6 @@
"tape": "^2.13.3",
"uglify-js": "^2.4.14",
"underscore": "^1.6.0",
"utf8": "^2.0.0",
"wildemitter": "^1.0.1",
"xmpp-jid": "^1.0.0"
},

0 comments on commit 937e674

Please sign in to comment.