qse/qse/samples/sed/sed00.c
hyung-hwan c6644d5b52 changed qse_setdflcmgrbyid() and qse_setdflcmgr() to return the cmgr object set.
changed the default cmgr to either SLMB or UTF8 depending on the availability of underlying library functions
2015-04-27 08:37:57 +00:00

34 lines
647 B
C

/* sed00.c */
#include "sed00.h"
#include <qse/cmn/mbwc.h>
#include <qse/cmn/fmt.h>
#include <locale.h>
#if defined(_WIN32)
# include <windows.h>
#endif
void init_sed_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("."));
setlocale (LC_ALL, locale);
/*qse_setdflcmgrbyid (QSE_CMGR_SLMB);*/
}
#else
setlocale (LC_ALL, "");
/*qse_setdflcmgrbyid (QSE_CMGR_SLMB);*/
#endif
}