int lenSend = odl->ByteSize(); char* buf = (char *)malloc(lenSend); odl->SerializeToArray(buf, lenSend);
我收到这个错误,我无法理解为什么我得到它(是的,我得到它三次):
libprotobuf ERROR google/protobuf/wire_format.cc:1059] Encountered string containing invalid UTF-8 data while serializing protocol buffer. Strings must contain only UTF-8; use the ‘bytes’ type for raw bytes.
libprotobuf ERROR google/protobuf/wire_format.cc:1059] Encountered string containing invalid UTF-8 data while serializing protocol buffer. Strings must contain only UTF-8; use the ‘bytes’ type for raw bytes.
libprotobuf ERROR google/protobuf/wire_format.cc:1059] Encountered string containing invalid UTF-8 data while serializing protocol buffer. Strings must contain only UTF-8; use the ‘bytes’ type for raw bytes.
谢谢.
您可以按照消息中的建议消除警告!odl(在.proto文件中)的定义中必须有一个或多个字段,这些字段定义为字符串,但是您要将非UTF-8字符放入其中. The docs state that you shouldn’t do this.如果将这些更改为字节,则警告应消失.