Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix string encoding. Closes #6.

  • Loading branch information...
commit 541f0210e7362c9367a162537d4857da1048783d 1 parent 9985497
@devongovett authored
Showing with 5 additions and 3 deletions.
  1. +2 −2 msgpack.coffee
  2. +3 −1 test.js
View
4 msgpack.coffee
@@ -142,11 +142,11 @@ class MsgPack
# raw16
else if size < 0x10000
- bytes.push 0xda
+ bytes.push 0xda, (size >>> 8) & 0xff, size & 0xff
# raw32
else if size < 0x100000000
- bytes.push 0xdb
+ bytes.push 0xdb, (size >>> 24) & 0xff, (size >>> 16) & 0xff, (size >>> 8) & 0xff, size & 0xff
else
throw 'String too long.'
View
4 test.js
@@ -22,7 +22,9 @@ var object = [
-0xFFFFFFFFFFFFFF0, // int64
1.0384583e+34, // double with all fraction bits on
- ]
+ ],
+ // long string
+ '50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75'
]
assert.deepEqual(MsgPack.unpack(MsgPack.pack(object)), object);
Please sign in to comment.
Something went wrong with that request. Please try again.