On Wed, Jan 20, 2021 at 21:11:49 -0500, Michael Richardson wrote: > > Josef 'Jeff' Sipek <[email protected]> wrote: > > Recently, I was thinking about the fun fact that the Unicode string > > "bor" and the byte string "BOR" end up getting encoded as "cbor" and > > "CBOR", respectively. > > obiwan-[work/richardson/cbor-file-magic](2.6.6) mcr 10355 %echo -n cbor | > cbor2diag.rb > "bor" > > obiwan-[work/richardson/cbor-file-magic](2.6.6) mcr 10356 %echo -n CBOR | > cbor2diag.rb > h'424F52'
Which is hex for 'B' 'O' 'R'. :) I'm guessing cbor2diag.rb sees the raw data and hexdumps it to be helpful. Here's what python has to say: In [1]: import cbor In [2]: cbor.loads(b'cbor') Out[2]: 'bor' In [3]: cbor.loads(b'CBOR') Out[3]: b'BOR' Note the difference in return type - the first is unicode string the second is a byte string. Jeff. _______________________________________________ COSE mailing list [email protected] https://www.ietf.org/mailman/listinfo/cose
