2012-01-03 14:41:15 +00:00
|
|
|
#include <qse/cmn/chr.h>
|
|
|
|
#include <qse/cmn/mbwc.h>
|
2016-04-29 03:55:42 +00:00
|
|
|
#include <qse/si/sio.h>
|
2012-01-03 14:41:15 +00:00
|
|
|
|
|
|
|
#include <locale.h>
|
|
|
|
|
|
|
|
#if defined(_WIN32)
|
|
|
|
# include <windows.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define R(f) \
|
|
|
|
do { \
|
|
|
|
qse_printf (QSE_T("== %s ==\n"), QSE_T(#f)); \
|
|
|
|
if (f() == -1) return -1; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
static int test1 (void)
|
|
|
|
{
|
|
|
|
qse_char_t c;
|
|
|
|
|
|
|
|
for (c = QSE_T('a'); c <= QSE_T('z'); c++)
|
|
|
|
{
|
|
|
|
qse_printf (QSE_T("%c => %c\n"), c, QSE_TOUPPER(c));
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main ()
|
|
|
|
{
|
|
|
|
#if defined(_WIN32)
|
2012-10-15 09:46:29 +00:00
|
|
|
char locale[100];
|
2012-01-03 14:41:15 +00:00
|
|
|
UINT codepage = GetConsoleOutputCP();
|
|
|
|
if (codepage == CP_UTF8)
|
|
|
|
{
|
|
|
|
/*SetConsoleOUtputCP (CP_UTF8);*/
|
2012-10-15 09:36:39 +00:00
|
|
|
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
|
2012-01-03 14:41:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-07-02 12:28:58 +00:00
|
|
|
sprintf (locale, ".%u", (unsigned int)codepage);
|
|
|
|
setlocale (LC_ALL, locale);
|
2015-04-27 08:37:57 +00:00
|
|
|
/*qse_setdflcmgrbyid (QSE_CMGR_SLMB);*/
|
2012-01-03 14:41:15 +00:00
|
|
|
}
|
|
|
|
#else
|
2014-07-02 12:28:58 +00:00
|
|
|
setlocale (LC_ALL, "");
|
2015-04-27 08:37:57 +00:00
|
|
|
/*qse_setdflcmgrbyid (QSE_CMGR_SLMB);*/
|
2012-01-03 14:41:15 +00:00
|
|
|
#endif
|
|
|
|
|
2015-03-11 06:12:48 +00:00
|
|
|
|
2017-09-16 08:54:25 +00:00
|
|
|
qse_open_stdsios ();
|
2015-03-11 06:12:48 +00:00
|
|
|
|
2012-01-03 14:41:15 +00:00
|
|
|
R (test1);
|
|
|
|
|
2017-09-16 08:54:25 +00:00
|
|
|
qse_close_stdsios ();
|
2015-03-11 06:12:48 +00:00
|
|
|
|
2012-01-03 14:41:15 +00:00
|
|
|
return 0;
|
|
|
|
}
|