title: String encoding VB6 / C++ dll
body: <p>I am having a problem with some characters in 2 strings that my program uses.</p>
  
  <p>String #1 is filled using VB code that gets data from a 3rd party application.
  String #2 gets similar data from the same 3rd party application, but it gets it with a C++ dll and sends it to VB.</p>
  
  <p>The data has some weird symbols in it.</p>
  
  <p>I don't know a whole lot about encoding and different character sets, but I'll try to explain it the best I can.</p>
  
  <p>I will use "Т" as my example character.</p>
  
  <p>"Т" (note this isnt a normal capital t) it is unicode decimal value 1058
  <a href="http://www.unicodemap.org/details/0x0422/index.html" rel="nofollow">http://www.unicodemap.org/details/0x0422/index.html</a></p>
  
  <p>When this character appears in String #1 during runtime it appears as "?", which I believe is just what VB6 does to show some unicode characters.  When I use AscW on the character it returns the correct value of 1058.</p>
  
  <p>When I output the string to a text file, it appears as "?". </p>
  
  <p>The same character in String #2 from the C++ DLL appears as 2 characters "Ð¢"</p>
  
  <p>When I output that string to a text file, the character appears properly as "Т".</p>
  
  <p>I was only outputting things to text files for testing purposes.  I only need the 2 strings to be encoded / appear the same during run time.  </p>
  
  <p>Any idea whats going on here?  Any way for me to get weird characters to appear the same in both strings?</p>
  
  <p>Thanks</p>
  
  <p>edit:  also the C++ dll is in multi character set and sends the data in a BSTR string</p>
  
  <p>CODE IN C++ DLL</p>
  
  <p>allChat is a CString</p>
  
  <pre><code>BSTR Message;
  int len = allChat.GetLength();
  Message = SysAllocStringByteLen ((LPCTSTR)allChat,len+1);
  </code></pre>
  
  <p>Message is returned to the VB app.. and nothing happens to the string after that.</p>
  
  <p>String #1 is just a regular VB string</p>