title: Google Protocol Buffer serialized string can contain embedded NULL characters in it?
body: <p>I am using Google Protocol Buffer for message serialization. 
  This is my sample proto file content.</p>
  
  <pre><code>package MessageParam;
  
  message Sample
  {
      message WordRec
      {
          optional uint64 id = 1; 
          optional string word = 2;
          optional double value = 3;
      }
      message WordSequence
      {
          repeated WordRec WordSeq = 1;
      }
  }
  </code></pre>
  
  <p>I am trying to serialize the message in C++ like following</p>
  
  <pre><code>MessageParam::Sample::WordSequence wordseq;
  for(int i =0;i&lt;10;i++)
  {
      AddRecords(wordseq.add_wordseq());
  }
  std::string str = wordseq.SerializeAsString();
  </code></pre>
  
  <p>After executing the above statement, the size of the str is 430. It is having embedded null characters in it. While I am trying to assign this str to std::wstring, std::wstring is terminating when it finds first null character.</p>
  
  <pre><code>void AddRecords(MessageParam::Sample::WordRec* wordrec)
  {
      int id;
      cin&gt;&gt;id;
      wordrec-&gt;set_id(id);
      getline(cin, *wordrec-&gt;mutable_word());
      long value;
      cin&gt;&gt;value;
      wordrec-&gt;set_value(value);
  }
  </code></pre>
  
  <p>Value of wordseq.DebugString() is
  <em>WordSeq {
    id: 4
    word: "software"
    value: 1
  }
  WordSeq {
    id: 19
    word: "technical"
    value: 0.70992374420166016
  }
  WordSeq {
    id: 51
    word: "hardware"
    value: 0.626017153263092
  }</em>
  How can I serialize "wordseq" as string which contains embedded NULL characters ?</p>