Thanks, will give that a shot On Monday, February 26, 2018 at 7:56:37 PM UTC, Feng Xiao wrote: > > > > > On Mon, Feb 26, 2018 at 5:54 AM <[email protected] <javascript:>> > wrote: > >> Hello, >> >> I'm hoping someone can help me out a bit here.. >> >> I've developed a C++ GRPC server (Question is protobuf specific though), >> that talks with a Java client. The C++ server takes data from an older C++ >> API and converts it to protobuf and then uses GRPC to send the data. >> >> However it appears that there may be a bug in the older API and i'm >> occasionally being sent garbage in some char*, which when they get to java >> result in an Protocol message had invalid UTF-8. >> >> It seems slightly odd that on the C++ side the protobuf is happy to >> accept and encode invalid data, but the Java side throws an exception. >> >> Is there anyway from the C++ side to validate the messages strings before >> they are sent. I've noticed if i convert the message to JSON the strings >> just stop at the first invalid character they reach. I looked at trying to >> find a simple UTF8 validation in C++ but not had much luck with this (Sorry >> C++ is really noy my main language) >> > You can use protobuf's VerifyUtf8String() method: > > https://github.com/google/protobuf/blob/master/src/google/protobuf/wire_format_lite.h#L345 > > >> >> Developing in Visual Studio 2017 with C++11 support >> >> Thanks, >> Robin >> >> -- >> 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://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 https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
