wire_format.cc:1091] String field 'accountid' contains invalid UTF-8 data when serializing a protocol buffer. Use the 'bytes' type if you intend to send raw bytes.

原因:

在protobuf 的string字段中存在中文,序列化的时候会出现截断数据,string这个类型带有检查功能

解决方法:

把protobuf中存在中文的string字段类型 改为bytes

string的序列化函数多以下代码

::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->strdeptname().data(), this->strdeptname().length(),
::google::protobuf::internal::WireFormat::PARSE,
"strdeptname");

posted @ 2017-08-04 09:18  苍洱  阅读(5136)  评论(0编辑  收藏  举报