#664 fixed utf16<=>utf8 conversion

This commit is contained in:
Vadim Grigoruk 2018-08-24 23:42:37 +03:00
parent 1f748f52aa
commit c2077356ad
3 changed files with 7 additions and 6 deletions

View File

@ -115,7 +115,7 @@ static const fsString* utf8ToString(const char* str)
{
fsString* wstr = malloc(FILENAME_MAX * sizeof(fsString));
mbstowcs(wstr, str, FILENAME_MAX);
MultiByteToWideChar(CP_UTF8, 0, str, FILENAME_MAX, wstr, FILENAME_MAX);
return wstr;
}
@ -124,7 +124,7 @@ static const char* stringToUtf8(const fsString* wstr)
{
char* str = malloc(FILENAME_MAX * sizeof(char));
wcstombs(str, wstr, FILENAME_MAX);
WideCharToMultiByte(CP_UTF8, 0, wstr, FILENAME_MAX, str, FILENAME_MAX, 0, 0);
return str;
}

View File

@ -49,8 +49,6 @@
#include <lauxlib.h>
#include <lualib.h>
#include <locale.h>
#define FRAME_SIZE (TIC80_FULLWIDTH * TIC80_FULLHEIGHT * sizeof(u32))
#define POPUP_DUR (TIC_FRAMERATE*2)
@ -1819,7 +1817,6 @@ static void studioClose()
Studio* studioInit(s32 argc, char **argv, s32 samplerate, const char* folder, System* system)
{
setlocale(LC_CTYPE, "");
setbuf(stdout, NULL);
impl.argc = argc;
impl.argv = argv;

View File

@ -20,6 +20,10 @@
#define KBD_COLS 22
#define KBD_ROWS 17
#if defined(__TIC_WINRT__) || defined(__TIC_WINDOWS__)
#include <windows.h>
#endif
static struct
{
Studio* studio;
@ -1202,7 +1206,7 @@ static void openSystemPath(const char* path)
sprintf(command, "explorer \"%s\"", path);
wchar_t wcommand[FILENAME_MAX];
mbstowcs(wcommand, command, FILENAME_MAX);
MultiByteToWideChar(CP_UTF8, 0, command, FILENAME_MAX, wcommand, FILENAME_MAX);
_wsystem(wcommand);