Can you provide a small reproduction of the problem? The generated code should not be doing any UTF8 validation. Is it possible you have a field defined elsewhere that has type 'string'?
On Tue, Sep 7, 2010 at 4:40 AM, Mk <kuznetsov.m...@gmail.com> wrote: > Hi. > I get funny problem. In proto file I have one "bytes" field, it used > for exchanging small binary array of data(~100 bytes). In java side it > is ok, because of using ByteString as container. But on C++ consumer I > get an error, when access to field: libprotobuf ERROR c:\projects > \protobuf-2.3.0\src\google\protobuf\wire_format.cc:1059] Encountered > string containing invalid UTF-8 data while parsing protocol buffer. > Strings must contain only UTF-8; use the 'bytes' type for raw bytes. > > In generated binding class I have only getter with return type > std::string. In this mail list i find two answers: > 1) strings is ok for binary data > 2) problem with zero bytes while presenting byte array as string > > The first answer is not Ok, because it add constraint for binary data. > Second one looks like true, but I cant do anything with it because of > container constrains. > > Any ideas how to convert byte array to string without UTF-8 check, or > how to get raw byte array? > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To post to this group, send email to proto...@googlegroups.com. > To unsubscribe from this group, send email to > protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.