1

Is there any way to print Greek characters in C? I'm trying to print out the word "ΑΝΑΓΡΑΜΜΑΤΙΣΜΟΣ" with:

printf("ΑΝΑΓΡΑΜΜΑΤΙΣΜΟΣ");

but I get some random symbols as output in the console.

Noam M
  • 3,156
  • 5
  • 26
  • 41
Shivalnu
  • 119
  • 2
  • 16
  • http://www.cprogramming.com/tutorial/unicode.html – Politank-Z May 15 '15 at 17:09
  • Possible duplicate of http://stackoverflow.com/questions/15528359/printing-utf-8-strings-with-printf-wide-vs-multibyte-string-literals – rost0031 May 15 '15 at 17:10
  • Essential reading: [The Absolute Minimum Every Programmer Should Know About Unicode ad Character Sets](http://www.joelonsoftware.com/articles/Unicode.html) – FoggyDay May 15 '15 at 17:17

2 Answers2

3

Set your console font to a Unicode TrueType font and emit the data using an "ANSI" mechanism (that's assuming Windows... ). For example this code prints γειά σου:

#include "windows.h"

int main() 
{
     SetConsoleOutputCP(1253); //"ANSI" Greek
     printf("\xE3\xE5\xE9\xDC \xF3\xEF\xF5"); // encoded as windows-1253

     return 0;
}
Noam M
  • 3,156
  • 5
  • 26
  • 41
1
  1. Use a console that supports Unicode, like Console2
  2. Use wprintf or similar functions
  3. Always use Unicode :)
Mark Segal
  • 5,427
  • 4
  • 31
  • 69