- . , Windows . #if.
#include <locale.h>
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#ifndef MS_STDLIB_BUGS
# if ( _WIN32 || _WIN64 )
# define MS_STDLIB_BUGS 1
# else
# define MS_STDLIB_BUGS 0
# endif
#endif
#if MS_STDLIB_BUGS
# include <io.h>
# include <fcntl.h>
#endif
void init_locale(void)
{
static const int wide_oriented = 1;
#if MS_STDLIB_BUGS
static const char locale_name[] = ".1200";
_setmode( _fileno(stdout), _O_WTEXT );
#else
static const char locale_name[] = "";
#endif
setlocale( LC_ALL, locale_name );
fwide( stdout, wide_oriented );
}
int main(void)
{
init_locale();
wprintf(L"μουσάων Ἑλικωνιάδων ἀρχώμεθ᾽\n");
return EXIT_SUCCESS;
}
UTF-8 , Visual Studio . Unicode, Lucida Console, . ASCII, %ls %lc printf(), Ive , .
UTF-8 ( Windows chcp 65001.), UTF-8 printf(u8"μουσάων Ἑλικωνιάδων ἀρχώμεθ᾽\n");. UTF-8 Windows, . , , .