title: C++ Visual Studio Unicode confusion
body: <p>I've been looking at the Unicode chart, and know that the first 127 code points are equivalent for almost all encoding schemes, ASCII (probably the original), UCS-2, ANSI, UTF-8, UTF-16, UTF-32 and anything else.  </p>
  
  <p>I wrote a loop to go through the characters starting from decimal 122, which is lowercase "z".  After that there are a couple more characters such as {, |, and }.  After that it gets into no-man's land which is basically around 20 "control characters", and then the characters begin again at 161 with an inverted exclamation mark, 162 which is the cent sign with a stroke through it, and so on.  </p>
  
  <p>The problem is, my results don't correspond the Unicode chart, UTF-8, or UCS-2 chart, the symbols seem random.  By the way, the reason I made the "character variable a four-byte int was that when I was using "char" (which is essentially a one byte signed data type, after 127 it cycled back to -128, and I thought this might be messing it up.  </p>
  
  <p>I know I'm doing something wrong, can anyone figure out what's happening?  This happens whether I set the character set to Unicode or Multibyte characters in the project settings.  Here is the code you can run.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main()
  {
      unsigned int character = 122; // Starting at "z"
      for (int i = 0; i &lt; 100; i++)
      {
          cout &lt;&lt; (char)character &lt;&lt; endl;
          cout &lt;&lt; "decimal code point = " &lt;&lt; (int)character &lt;&lt; endl;
          cout &lt;&lt; "size of character =  " &lt;&lt;  sizeof(character) &lt;&lt; endl;
          character++;
          system("pause");
          cout &lt;&lt; endl;
      }
  
      return 0;
  }
  </code></pre>
  
  <p>By the way, here is the Unicode chart </p>
  
  <p><a href="http://unicode-table.com/en/#control-character" rel="nofollow">http://unicode-table.com/en/#control-character</a></p>