Right! Sorry for my lack of attention and thank you very much.

Best,

Felipe

2015-06-07 8:33 GMT-03:00 Mkhanyisi Madlavana <mmadlav...@gmail.com>:

> The numbers
>
> 12 07 74 65 73 74 69 6e 67
>
>
> are in the hexidecimal number system not in decimal number system. For
> example 6e is a hexadecimal equivalent for 110 in decimal number system. So
> 12 in hexadecimal is actually 0x12 which is 18 in decimal number system.
>
> On Wednesday, June 3, 2015 at 2:39:15 AM UTC+2, Felipe Miranda wrote:
>>
>> On the following example, from the encoding page (
>> https://developers.google.com/protocol-buffers/docs/encoding) :
>> Strings
>>
>> A wire type of 2 (length-delimited) means that the value is a varint
>> encoded length followed by the specified number of bytes of data.
>>
>> message Test2 {
>>   required string b = 2;
>> }
>>
>> Setting the value of b to "testing" gives you:
>>
>> 12 07 74 65 73 74 69 6e 67
>>
>> The red bytes are the UTF8 of "testing". The key here is 0x12 → tag = 2,
>> type = 2. The length varint in the value is 7 and lo and behold, we find
>> seven bytes following it – our string.
>>
>> Isn't the first byte 18, instead of 12? 12 gives a tag=1, type=4, while
>> 18 gives the expected result of tag=2, type=2.
>>
>> Regards,
>>
>> Felipe
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at http://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to