title: C++: how to convert ASCII or ANSI to UTF8 and stores in std::string
body: <p>My company use some code like this:</p>
  
  <pre><code>    std::string(CT2CA(some_CString)).c_str()
  </code></pre>
  
  <p>which I believe it converts a Unicode string (whose type is CString)into ANSI encoding, and this string is for a email's subject. However, header of the email (which includes the subject) indicates that the mail client should decode it as a unicode (this is how the original code does). Thus, some German chars like "ä ö ü" will not be properly displayed as the title. </p>
  
  <p>Is there anyway that I can put this header back to UTF8 and store into a std::string or const char*?</p>
  
  <p>I know there are a lot of smarter ways to do this, but I need to keep the code sticking to its original one (i.e. sent the header as std::string or const char*).</p>
  
  <p>Thanks in advance.</p>