title: How to setLocale when converting char* to wchar_t*?
body: <p>I won't lie, I pinched this code from <a href="https://stackoverflow.com/a/8032109/866333">https://stackoverflow.com/a/8032109/866333</a>:</p>
  <pre><code>std::wstring *GetWC(const char *c)
  {
      const size_t cSize = strlen(c)+1;
      std::wstring wc( cSize, L'#' );
      mbstowcs( &amp;wc[0], c, cSize );
      //wchar_t wc[cSize];
      //mbstowcs (wc, c, cSize);
  
      return wc;
  }
  </code></pre>
  <p>I'm trying to determine what is meant by, eg:</p>
  <blockquote>
  <p>Remember to set relevant locale in main.</p>
  <p>E.g., setlocale( LC_ALL, &quot;&quot; ).</p>
  </blockquote>
  <p>In my case I read in UTF-8 (initially was ISO 8859-1 but that was breaking stuff) from files and I believe all my literals are ISO 8859-1 since that is my locale and I have too many source files to convert easily in Windows. I am targetting Android. I was kind of hoping to maybe mix ISO 8859-1 and UTF-8! Must I convert to one?</p>
  <p>Let me get this right, I need to <code>setLocale</code> to delegate conversion routines? Just as I have them down pat! I'm keen for efficiency but it seems like this is messing with possibly static global variables? This is bound to have side effects if the locale was initially radically different?</p>
  <p>Without <code>setLocale</code> or <code>mbstowcs</code> would <a href="https://stackoverflow.com/a/4826290/866333">https://stackoverflow.com/a/4826290/866333</a></p>
  <pre><code>wchar_t  ws[100];
  swprintf(ws, 100, L&quot;%hs&quot;, &quot;ansi string&quot;);
  </code></pre>
  <p>be possible still? I don't see %hs in my libc manual.</p>
  <p>Could <code>setLocale</code> obviate converting my full 8-bit (ASCII/ISO-8859-1) to multibyte UTF-8 and hence save string manipulation?</p>
  <p>Sorry to have so many questions.</p>