1

有没有办法在 C 中打印希腊字符?我正在尝试打印出“ΑΝΑΓΡΑΜΜΑΤΙΣΜΟΣ”这个词:

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

但我在控制台中得到了一些随机符号作为输出。

4

2 回答 2

3

将您的控制台字体设置为 Unicode TrueType 字体并使用“ANSI”机制(假设 Windows...)发出数据。例如,此代码打印 γειά σου:

#include "windows.h"

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

     return 0;
}
于 2015-05-15T17:26:05.993 回答
1
  1. 使用支持 Unicode 的控制台,例如Console2
  2. 使用wprintf或类似功能
  3. 始终使用 Unicode :)
于 2015-05-15T17:11:15.130 回答