Closed glenn-edgar closed 6 years ago
Hi!
0xb0
is the fixstr
type, which is a range type starting at 0xa0
. In order to compute the length of the ensuing string, you just take the value (0xb0
in this case) and subtract 0xa0
-- which would give you 16. It's a little more complicated than "one value -> one type", but it's very efficient as most values are pretty small.
Let me know if I can explain it better. Is there a problem with CMP decoding data from Python's msgpack
library?
python3 for certain utf-8 strings produces the 0xb0 encoding. cmp.c appears not to recognize this object type.
I was checking whether you were aware of this problem.
Thanks
Glenn Edgar
On Thu, Sep 13, 2018 at 7:08 AM Charlie Gunyon notifications@github.com wrote:
Hi!
0xb0 is the fixstr type, which is a range type starting at 0xa0. In order to compute the length of the ensuing string, you just take the value (0xb0 in this case) and subtract 0xa0 -- which would give you 16. It's a little more complicated than "one value -> one type", but it's very efficient as most values are pretty small.
Let me know if I can explain it better. Is there a problem with CMP decoding data from Python's msgpack library?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/camgunz/cmp/issues/46#issuecomment-421020030, or mute the thread https://github.com/notifications/unsubscribe-auth/AKMefNtkbsCzCmqWqtTgNDPVS0Lv-b12ks5uambKgaJpZM4WmEfy .
Sorry about raising the issue. Your explanation helped me and I saw how the 0xb0 type was handled in your code.
Went back and ran test code and the 0xb0 string was properly handled. No issue with you code.
Thanks for your good work
On Thu, Sep 13, 2018 at 7:08 AM Charlie Gunyon notifications@github.com wrote:
Hi!
0xb0 is the fixstr type, which is a range type starting at 0xa0. In order to compute the length of the ensuing string, you just take the value (0xb0 in this case) and subtract 0xa0 -- which would give you 16. It's a little more complicated than "one value -> one type", but it's very efficient as most values are pretty small.
Let me know if I can explain it better. Is there a problem with CMP decoding data from Python's msgpack library?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/camgunz/cmp/issues/46#issuecomment-421020030, or mute the thread https://github.com/notifications/unsubscribe-auth/AKMefNtkbsCzCmqWqtTgNDPVS0Lv-b12ks5uambKgaJpZM4WmEfy .
No problem, it's pretty confusing. Thanks for being a proactive user though, let me know if you have other questions!
See Example Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
Question 2: How can the type be incorporated into cmp.c
I am using your libraray on an ESP32 to communication to a linux server.
Thanks for your good work.