Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The result of msgpack-lite is different from msgpack official tool. #67

Closed
finscn opened this issue Mar 12, 2017 · 2 comments
Closed

The result of msgpack-lite is different from msgpack official tool. #67

finscn opened this issue Mar 12, 2017 · 2 comments

Comments

@finscn
Copy link

finscn commented Mar 12, 2017

the test data :

    {
            a: [127, 127, 127],
            b: [255, 255, 255],
            c: [32767, 32767, 32767],
            d: [65535, 65535, 65535],
            e: [2147483647, 2147483647, 2147483647],
            f: [4294967295, 4294967295, 4294967295],
            g: [3.14, 3.14, 3.14],
            h: [2.71, 2.71, 2.71],
            i: [true, true, true],
            j: ["c'est bien! 哈哈", "je le sais", "c'est pas bon"],
     }

When I use http://msgpack.org/ online test to encode data, the size of result is 189.
When I use msgpack-lite encode , the size is 201.

@finscn finscn changed the title The result is different from msgpack-node The result of msgpack-lite is different from msgpack official tool. Mar 12, 2017
@kawanet
Copy link
Owner

kawanet commented Mar 13, 2017

Do you have any problem at decoded objects?
Please don't compare the encoded byte arrays but compare the objects decoded.
Because each encoders would have a difference on optimizing for encoded byte array.

For instance, http://msgpack.org/ encodes 4294967295 to ce ff ff ff ff.
http://kawanet.github.io/msgpack-lite/ encodes it to CB 41 EF FF FF FF E0 00 00.
Those are same value.
JavaScript does not have the primitive unsigned 32bit integer type.

@finscn
Copy link
Author

finscn commented Mar 13, 2017

Oh, I see. Thanks.

It could be decoded.

@finscn finscn closed this as completed Mar 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants