title: Drawing a TicTacToe-field with UTF-8 symbols in C
body: <p>I have a little TicTacToe game and draw the TicTacToe field with the standart ANSII symbols.<br> This is my normal <code>drawfield</code> function:</p>
  
  <pre><code>void drawField(char *field) {
  
  printf("            ________________________\n");
  printf("            |       |       |      |\n");
  printf("            |   %c   |   %c   |   %c  |\n", field[0], field[1], field[2]);
  printf("            |_______|_______|______|\n");
  printf("            |       |       |      |\n");
  printf("            |   %c   |   %c   |   %c  |\n", field[3], field[4], field[5]);
  printf("            |_______|_______|______|\n");
  printf("            |       |       |      |\n");
  printf("            |   %c   |   %c   |   %c  |\n", field[6], field[7], field[8]);
  printf("            |_______|_______|______|\n");
  
  } 
  </code></pre>
  
  <p>Our Tutor/Mentor on my university just made the same field with UTF-8 characters like ┌ ┐└ ┘├, ... . He did this on his Mac coded the whole thing in the simple Apple Texteditor, Gnu-Compiler. So I asked him to send me the code for his drawField function: </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;locale.h&gt;
  char* getcharacter(char character){
  switch(character){
      case 'x':
          return "\u2620";
      case 'o':
          return "\u2622";
      case '0':
          return "\u24EA";
      case '1':
          return "\u2460";
      case '2':
          return "\u2461";
      case '3':
          return "\u2462";
      case '4':
          return "\u2463";
      case '5':
          return "\u2464";
      case '6':
          return "\u2465";
      case '7':
          return "\u2466";
      case '8':
          return "\u2467";
      default:
          return " ";
     }
  }
  
  void drawField(char *field){
  printf("\033[H\033[J");
  printf("\u250F\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2513\n");
  printf("\u2503 %s \u2503 %s \u2503 %s \u2503\n", getcharacter(field[0]), getcharacter(field[1]), getcharacter(field[2]));
  printf("\u2523\u2501\u2501\u2501\u254B\u2501\u2501\u2501\u254B\u2501\u2501\u2501\u252B\n");
  printf("\u2503 %s \u2503 %s \u2503 %s \u2503\n", getcharacter(field[3]), getcharacter(field[4]), getcharacter(field[5]));
  printf("\u2523\u2501\u2501\u2501\u254B\u2501\u2501\u2501\u254B\u2501\u2501\u2501\u252B\n");
  printf("\u2503 %s \u2503 %s \u2503 %s \u2503\n", getcharacter(field[6]), getcharacter(field[7]), getcharacter(field[8]));
  printf("\u2517\u2501\u2501\u2501\u253B\u2501\u2501\u2501\u253B\u2501\u2501\u2501\u251B\n");
  }
  </code></pre>
  
  <p>Im coding in Visual Studio 2015 and for me the \u Escape Sequences dont work of course - they are just a bunch of ?, ... .</p>
  
  <p>So I tried this to get at least the symbols inside the fields working:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;locale.h&gt;
  wchar_t sym = ' ';
  wchar_t getcharacter(char character) {
  switch (character) {
  case 'X':
      sym = L'\u2620';
      return sym;
  case 'O':
      sym = L'\u2622';
      return sym;
  case '1':
      sym = L'\u2460';
      return sym;
  case '2':
      sym = L'\u2461';
      return sym;
  case '3':
      sym = L'\u2462';
      return sym;
  case '4':
      sym = L'\u2463';
      return sym;
  case '5':
      sym = L'\u2464';
      return sym;
  case '6':
      sym = L'\u2465';
      return sym;
  case '7':
      sym = L'\u2466';
      return sym;
  case '8':
      sym = L'\u2467';
      return sym;
  case '9':
      sym = L'\u2468';
      return sym;
  default:
      sym = ' ';
      return sym;
      }
  }
  
  void drawField(char *field) {
  printf("\033[H\033[J");
  printf("\u250F\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2513\n");
  printf("\u2503 %s \u2503 %s \u2503 %s \u2503\n", getcharacter(field[0]), getcharacter(field[1]), getcharacter(field[2]));
  printf("\u2523\u2501\u2501\u2501\u254B\u2501\u2501\u2501\u254B\u2501\u2501\u2501\u252B\n");
  printf("\u2503 %s \u2503 %s \u2503 %s \u2503\n", getcharacter(field[3]), getcharacter(field[4]), getcharacter(field[5]));
  printf("\u2523\u2501\u2501\u2501\u254B\u2501\u2501\u2501\u254B\u2501\u2501\u2501\u252B\n");
  printf("\u2503 %s \u2503 %s \u2503 %s \u2503\n", getcharacter(field[6]), getcharacter(field[7]), getcharacter(field[8]));
  printf("\u2517\u2501\u2501\u2501\u253B\u2501\u2501\u2501\u253B\u2501\u2501\u2501\u251B\n");
  } 
  </code></pre>
  
  <p>I have to admit that I have no idea about UTF-8 printing in C - could someone help me?</p>