zoukankan      html  css  js  c++  java
  • 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");

  • 相关阅读:
    生成器
    迭代器
    装饰器
    闭包函数
    函数对象
    函数
    文件
    字符编码
    基本的数据类型和内置方法02
    基本的数据类型和内置方法01
  • 原文地址:https://www.cnblogs.com/a9999/p/7283244.html
Copyright © 2011-2022 走看看