title: The size of my buffer change when I convert an unsigned char to a string
body: <p>I'm having issues with a type conversion that I can't explain. </p>
  
  <p><strong>Here is what i would like to do</strong></p>
  
  <p>I have a buffer that I dynamically allocate and i need to convert it to a string in order to use a parsing function from an external library.</p>
  
  <p><strong>My implementation</strong></p>
  
  <pre><code>unsigned char* msg_data;
  msg_data = (unsigned char*)malloc(msg_data_length);
  string msg_data_str = std::string(reinterpret_cast&lt;const char*&gt;(_msg_data));
  SomeObject myObject;
  myObject.ParseFromString(msg_data_str);
  </code></pre>
  
  <p>But here is the thing : my parsing function fails because it receives the wrong size of data.
  Let's say that i have a buffer of size <code>msg_data_length = 10</code>, the size of my string is <code>my_data_str.size() = 14</code>.</p>
  
  <p>I get rid of my problem by using <code>my_data_str.resize(my_data_length)</code>
  but I would like to understand why the size of <code>my_data_str</code> is not directly <code>msg_data_length</code>.</p>
  
  <p>Thanks for your help !</p>