浏览代码

Fixed Bug in Double Byte Code in utf8Read

Code before fix was extracting 4-bits from 1st utf8 Byte instead of 5 bits, resulting in 10-bit binary number instead of 11-bit as specified for Double Byte.
kkruups 8 年之前
父节点
当前提交
45c15c792f
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      examples/js/libs/msgpack-js.js

+ 1 - 1
examples/js/libs/msgpack-js.js

@@ -87,7 +87,7 @@ function utf8Read(view, offset, length) {
     // Two byte character
     if ((byte & 0xe0) === 0xc0) {
       string += String.fromCharCode(
-        ((byte & 0x0f) << 6) | 
+        ((byte & 0x1f) << 6) | 
         (view.getUint8(++i) & 0x3f)
       );
       continue;