title: Using Chinese characters in sqlite3
body: <p>I am from china, and I have a question about sqlite, but my English is a bit poor. I'll try to express myself clearly.</p>
  
  <p>Recently, I did something in sqlite using Visual Studio 2005 (VC++) for WinCE development, using an sqlite database. In my table, a field includes some Chinese characters. When i display these, I don't get what I want, because they are all strange characters.</p>
  
  <p>I use the functions' return column value that I want, but I can't.</p>
  
  <pre><code>const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
  // or
  const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
  </code></pre>
  
  <p>They said the encodings in sqlite3 is utf8, so you need convert it to unicode. I tried to do this work using a function found on the internet that looks like this:</p>
  
  <pre><code>wstring UTF8ToUnicode(const string&amp; strin)
  {
      wstring strOut;
      int dwNum = MultiByteToWideChar(CP_UTF8,0,strin.c_str(),-1,0,0)
      wchar_t* pBuffer = new wchar_t[dwNum];
      if (!pBuffer){return strOut;}
      memset(pBuffer,0,dwNum*sizeof(wchar_t));
      if (MultiByteToWideChar(CP_UTF8,0,strin.c_str(),-1,pBuffer,dwNum)&gt;=0)
      {
          strOut= pBuffer;
      }
      delete[] pBuffer;
      return strOut;
  }
  </code></pre>