당신은 시스템을 시도 할 수 있습니다 ("cmd를/C lambdabath") 또는 시스템의 예에서와 같이 ("lambdabath") :
//Save As UTF-8 withput BOM signature
#include <stdlib.h>
#include <windows.h>
int main() {
SetConsoleOutputCP(CP_UTF8);
//system("cmd /c lambdabath");
system("lambdabath");
}
lambdabath.bat (또한 BOM 서명없이 UTF-8로 저장) :
chcp 65001
echo Ιλιάδα
질문 : 국제 문자를 Windows 콘솔로 보내는 방법은 무엇입니까?
그럼 당신은 다른 인코딩을 시도 할 수 있습니다. function system()을 사용하지 않아도됩니다.
윈도우 1,253 인코딩 :
//Save As Windows 1253
#include <stdio.h>
#include <windows.h>
int main()
{
SetConsoleOutputCP(1253);
char *ansichar_ = "Ιλιάδα";
unsigned char lambda1253char = 'λ';
printf("ansichar_: %s\n", ansichar_);
printf("λ %#x\n", lambda1253char);
}
결과 :
ansichar_: Ιλιάδα
λ 0xeb
UTF-16 인코딩 :
//Save As UTF16 (Unicode)
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <wchar.h>
int main()
{
_setmode(_fileno(stdout), _O_U16TEXT);
wchar_t *wchar_ = L"Ιλιάδα";
wchar_t lambdaWchar = L'λ';
wprintf(L"wchar_: %s\n", wchar_);
wprintf(L"λ %#x\n", lambdaWchar);
}
결과 :
wchar_: Ιλιάδα
λ 0x3bb
UTF-8 인코딩 :
//Save As UTF8 without BOM signature
#include <stdio.h>
#include <windows.h>
int main()
{
SetConsoleOutputCP(65001);
char *utf8char_ = "Ιλιάδα";
int lambdaUTF8char = 'λ';
printf("utf8char_: %s\n", utf8char_);
printf("λ %#x\n", lambdaUTF8char);
}
결과 : 루시다 콘솔 : 어떤 경우에
utf8char_: Ιλιάδα
λ 0xcebb
기본 콘솔 폰트 세트.
고맙습니다. 작동합니다. – rsk82