qse/samples/awk/awk00.c

34 lines
647 B
C
Raw Normal View History

2013-01-12 16:46:12 +00:00
/* awk00.c */
#include "awk00.h"
#include <qse/cmn/mbwc.h>
#include <qse/cmn/fmt.h>
2013-01-12 16:46:12 +00:00
#include <locale.h>
#if defined(_WIN32)
# include <windows.h>
#endif
void init_awk_sample_locale (void)
{
#if defined(_WIN32)
char locale[100];
UINT codepage = GetConsoleOutputCP();
if (codepage == CP_UTF8)
{
/*SetConsoleOutputCP (CP_UTF8);*/
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
}
else
{
qse_fmtuintmaxtombs (locale, QSE_COUNTOF(locale),
codepage, 10, -1, QSE_MT('\0'), QSE_MT("."));
2013-01-12 16:46:12 +00:00
setlocale (LC_ALL, locale);
/*qse_setdflcmgrbyid (QSE_CMGR_SLMB);*/
2013-01-12 16:46:12 +00:00
}
#else
setlocale (LC_ALL, "");
/*qse_setdflcmgrbyid (QSE_CMGR_SLMB);*/
2013-01-12 16:46:12 +00:00
#endif
}