Merge pull request #154 from torhve/better-string-decoding

Decode and encode array directly without for loop
This commit is contained in:
David Cormier 2014-02-18 09:56:06 -05:00
commit 6814379bdb
1 changed files with 4 additions and 5 deletions

View File

@ -572,13 +572,12 @@
* @return Decoded string * @return Decoded string
*/ */
WeeChatProtocol._uia2s = function(uia) { WeeChatProtocol._uia2s = function(uia) {
var str = []; if(!uia.length || uia[0] === 0) return "";
for (var c = 0; c < uia.length && uia[c] !== 0; c++) { var encodedString = String.fromCharCode.apply(null, uia),
str.push(String.fromCharCode(uia[c])); decodedString = decodeURIComponent(escape(encodedString));
}
return decodeURIComponent(escape(str.join(''))); return decodedString;
}; };
/** /**