#664 fixed utf16<=>utf8 conversion
This commit is contained in:
		
							
								
								
									
										4
									
								
								src/fs.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								src/fs.c
									
									
									
									
									
								
							@@ -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;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user