Skip to content

Commit

Permalink
Merge pull request #1 from ghostoy/master
Browse files Browse the repository at this point in the history
Fix a bug when calculating the length of string containing non-ASCII characters
  • Loading branch information
michelle committed Feb 16, 2013
2 parents c965e5f + a642256 commit 439bcd4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/binarypack.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ Packer.prototype.pack_bin = function(blob){
}

Packer.prototype.pack_string = function(str){
var length = str.length;
var blob = new Blob(str);
var length = blob.size;
if (length <= 0x0f){
this.pack_uint8(0xb0 + length);
} else if (length <= 0xffff){
Expand Down

0 comments on commit 439bcd4

Please sign in to comment.