String max length is 255. Correct?

4,171 views
Skip to first unread message

David Mullineux

unread,
Dec 14, 2016, 8:43:28 AM12/14/16
to Protocol Buffers
The encoding suggests that strings are encoded with a 1 byte length prefix. This means my strings cannot be larger than 255 in size. How can I store longer strings please?

Ilia Mirkin

unread,
Dec 14, 2016, 10:00:40 AM12/14/16
to David Mullineux, Protocol Buffers
The length is stored as a varint; you should be able to store strings
of any length, up to 64-bit.

On Wed, Dec 14, 2016 at 8:43 AM, David Mullineux <dmu...@gmail.com> wrote:
> The encoding suggests that strings are encoded with a 1 byte length prefix. This means my strings cannot be larger than 255 in size. How can I store longer strings please?
>
> --
> 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+u...@googlegroups.com.
> To post to this group, send email to prot...@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.

David Mullineux

unread,
Dec 14, 2016, 11:24:53 AM12/14/16
to Protocol Buffers
You are correct of course. Thanks. The example on the encoding page is for only 1 byte. Hence my initial confusion. Thanks for the speedy response
Reply all
Reply to author
Forward
0 new messages