> What am I doing wrong? What's the best way to do java string > serialization of protobuf messages?
The native wire format of protocol buffers is just a sequence of bytes, so it can contain values that are invalid UTF-8 (or any encoding that has invalid byte sequences). Trying to pack that into a String, which holds Unicode character data, isn't going to work well; Strings are welcome to mangle the bytes however they want as long as the same characters are represented. If you want to pass a serialized protocol buffer to something else, you should generally use a ByteString, byte[], or ByteBuffer. If you absolutely have to pass things around as a String, you're going to need to do so in some kind of encoding that supports arbitrary data. For example, you could encode it in Base64. - Adam -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
