title: Converting "normal" std::string to utf-8
body: <p>Let's see if I can explain this without too many factual errors...</p>
  
  <p>I'm writing a string class and I want it to use <code>utf-8</code> (stored in a std::string) as it's internal storage.
  I want it to be able to take both "normal" <code>std::string</code> and <code>std::wstring</code> as input and output.</p>
  
  <p>Working with std::wstring is not a problem, I can use <code>std::codecvt_utf8&lt;wchar_t&gt;</code> to convert both from and to std::wstring.</p>
  
  <p>However after extensive googling and searching on SO I have yet to find a way to convert between a "normal/default" C++ std::string (which I assume in Windows is using the local system localization?) and an utf-8 std::string.</p>
  
  <p>I guess one option would be to first convert the std::string to an std::wstring using <code>std::codecvt&lt;wchar_t, char&gt;</code> and then convert it to utf-8 as above, but this seems quite inefficient given that at least the first 128 values of a char should translate straight over to utf-8 without conversion regardless of localization if I understand correctly.</p>
  
  <p>I found this similar question: <a href="https://stackoverflow.com/questions/20275824/c-how-to-convert-ascii-or-ansi-to-utf8-and-stores-in-stdstring">C++: how to convert ASCII or ANSI to UTF8 and stores in std::string</a>
  Although I'm a bit skeptic towards that answer as it's hard coded to latin 1 and I want this to work with all types of localization to be on the safe side.</p>
  
  <p>No answers involving boost thanks, I don't want the headache of getting my codebase to work with it.</p>