There is no practical way to avoid having zero bytes in the serialized message. For example, zero-valued integer fields will show up as zero bytes in the serialized message. If you need the serialized form to contain only printable characters, you could try base64-encoding it as an additional step.
On Wed, Sep 2, 2020 at 12:33 PM Saurabh Grade <[email protected]> wrote: > Hi, > > Using SerializeToString to serialize a protobuf object and getting NULL > character in serialized string. > What could be the reason of this? > How can we avoid NULL characters in serialized string? > > Please let me know if more details are needed. > > Thanks in advance. > > Thanks and Regards, > Saurabh Grade > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/protobuf/fc6f5c69-0538-43df-ad02-266539778b81n%40googlegroups.com > <https://groups.google.com/d/msgid/protobuf/fc6f5c69-0538-43df-ad02-266539778b81n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/CADqAXr7%2Bnfm%3DQtnQGO6SwD5nefSwYbpLbsPKW7XvpseA77SvLw%40mail.gmail.com.
