title: How to convert ANSI byte to Unicode string?
body: <p>I have an <code>vector&lt;BYTE&gt;</code> that represents characters in a string.  I want to interpret those characters as ASCII characters and store them in a Unicode (UTF-16) string.  The current code assumes that the characters in the <code>vector&lt;BYTE&gt;</code> are Unicode rather than ASCII.  This works fine for standard ASCII, but fails for extended ASCII characters.  These characters need to be interpreted using the current code page retrieved via <code>GetACP()</code>. How would I go about creating a Unicode (UTF-16) string with these ASCII characters?</p>
  
  <p>EDIT: I believe the solution should have something to do with the macros discussed here: <a href="http://msdn.microsoft.com/en-us/library/87zae4a3(v=vs.80).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/87zae4a3(v=vs.80).aspx</a>  I'm just not exactly sure how the actual implementation would go.</p>
  
  <pre><code>int ExtractByteArray(CATLString* pszResult, const CByteVector* pabData)
  {
      // place the data into the output cstring
      pszResult-&gt;Empty();
      for(int iIndex = 0; iIndex &lt; pabData-&gt;GetSize(); iIndex++)
          *pszResult += (TCHAR)pabData-&gt;GetAt(iIndex);
  
      return RC_SUCCESS;
  }
  </code></pre>