protobuf does not "use" \r or \n for any specific purposes. It does, however, assume that it can use any byte it chooses. There is no way to restrict that. You would have to create a protocol to encode arbitrary bytes over your not-binary-safe-channel, which would have to create a way to escape \r and \n (what about \0? can't imagine it'd be too happy about that either).
-ilia On Thu, May 15, 2014 at 1:33 PM, Ganesh Sangle <[email protected]> wrote: > Let me clarify the question. > 1. I did not say that protobuf is affected by \r\n. > 2. The problem is this: > Take any message with repeated fields, and serialize it to text. > The serialized message contains \r\n which are inserted by protobuf, which > it is using as some kind of delimiter. > That is throwing off my code which is itself using \r\n as a delimiter. > > So the question is : is there a way to configure protobuf to use something > else as a delimiter and not \r\n ? > > Thanks, > Ganesh > > On Wednesday, May 14, 2014 11:48:37 PM UTC-7, Marc Gravell wrote: >> >> protobuf is a binary-safe protocol, and is not impacted by contents such >> as \r, \n or \t. In particular, text content is utf-8 encoded and >> length-prefixed - it simply *does not care* what is inside the text. I >> suspect any problem you are having relates to how you are transporting and >> processing the payload, not to protobuf itself. Because protobuf does not >> check for \r, \n or \t at any point. >> >> Marc >> >> >> On 15 May 2014 00:56, Ganesh Sangle <[email protected]> wrote: >>> >>> Hi Guys, >>> I am trying to use protobufs between two entities - one in python and >>> another in c++. >>> The advantage of using protobuf is i dont have to write >>> serializing/deserializing code. >>> >>> However, there is a complication. >>> The message that I create in python world, when i serialize it to be sent >>> over to the other side, has '\r\n'. >>> The code on the other side is already using \n as a delimiter and cutting >>> out the strings. >>> So what happens is that the message string gets split and when I try to >>> re-assemble it it doent work. >>> >>> Since my code is a smaller part of a larger existing system, I wanted to >>> know if there is a way to customize/configure protobuf so that it uses some >>> other characters instead of '\n\t', or just use a different representation >>> (all hex numbers or whatever) when converting it to string. >>> >>> Thanks, >>> Ganesh >>> >>> -- >>> 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 post to this group, send email to [email protected]. >>> >>> Visit this group at http://groups.google.com/group/protobuf. >>> For more options, visit https://groups.google.com/d/optout. >> >> >> >> >> -- >> Regards, >> >> Marc > > -- > 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 post to this group, send email to [email protected]. > 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
