Index: cpp/common/nonstd_stdio.cpp
===================================================================
--- cpp/common/nonstd_stdio.cpp	(revision 247)
+++ cpp/common/nonstd_stdio.cpp	(revision 281)
@@ -5,29 +5,37 @@
 #include "nonstd_stdio.h"
 #include "nonstd.h"
-#include "Convert.h" //strTOwstr()
+#include "Convert.h" //utf8ToUtf16()
 #include <common/stl-util.h>
 
 #if defined _WIN32 && !defined SHP
- //<unistd.h> not needed for unlink()
- #include "Shlwapi.h" //PathIsRelative()
- #include <sys/stat.h> //_stat
-#else
- #include <unistd.h>
+//<unistd.h> not needed for unlink()
+#include "Shlwapi.h" //PathIsRelative()
+#include <sys/stat.h> //_stat
+#else
+#include <unistd.h>
 #endif
 
 bool fileExists(const char* path)
 {
-//lepiej gdyby uzywalo stat bo mfopen mogloby cos niepotrzebnie wczytywac przy otwarciu pliku ale mfopen wiadomo ze zadziala wszedzie tak samo
-MFILE *f=mfopen(path,FOPEN_READ_BINARY);
-if (f==NULL) return false;
-mfclose(f);
-return true;
+	//lepiej gdyby uzywalo stat bo mfopen mogloby cos niepotrzebnie wczytywac przy otwarciu pliku ale mfopen wiadomo ze zadziala wszedzie tak samo
+#ifdef _WIN32
+	MFILE *f = mfopen(Convert::utf8ToUtf16(path).c_str(), Convert::strTOwstr(FOPEN_READ_BINARY).c_str());
+#else
+	MFILE *f = mfopen(path, FOPEN_READ_BINARY);
+#endif
+	if (f == NULL) return false;
+	mfclose(f);
+	return true;
 }
 
 bool directoryExists(const char* path)
 {
-struct _stat s;
-if (_stat(path,&s)!=0) return false;
-return S_ISDIR(s.st_mode);
+	struct _stat s;
+#ifdef _WIN32
+	if (_wstat(Convert::utf8ToUtf16(path).c_str(), &s) != 0) return false;
+#else
+	if (_stat(path, &s) != 0) return false;
+#endif
+	return S_ISDIR(s.st_mode);
 }
 
@@ -35,7 +43,7 @@
 {
 #ifdef _WIN32
-return mkdir(path)==0;
-#else
-return mkdir(path,0777)==0;
+	return _wmkdir(Convert::utf8ToUtf16(path).c_str()) == 0;
+#else
+	return mkdir(path,0777) == 0;
 #endif
 }
@@ -43,32 +51,40 @@
 bool makeDirectories(const char* path)
 {
-if (directoryExists(path)) return true;
-string parentdir=getFileDir(path);
-if (!makeDirectories(parentdir.c_str())) return false;
-return makeDirectory(path);
+	if (directoryExists(path)) return true;
+	string parentdir = getFileDir(path);
+	if (!makeDirectories(parentdir.c_str())) return false;
+	return makeDirectory(path);
 }
 
 int getFileSize(const char* path)
 {
-int size;
-MFILE *f=mfopen(path,FOPEN_READ_BINARY);
-if (f==NULL) return -1;
-size=getFileSize(f);
-mfclose(f);
-return size;
+	int size;
+#ifdef _WIN32
+	MFILE *f = mfopen(Convert::utf8ToUtf16(path).c_str(), Convert::strTOwstr(FOPEN_READ_BINARY).c_str());
+#else
+	MFILE *f = mfopen(path, FOPEN_READ_BINARY);
+#endif
+	if (f == NULL) return -1;
+	size = getFileSize(f);
+	mfclose(f);
+	return size;
 }
 
 int getFileSize(MFILE *f)
 {
-  int saved_pos = mftell(f);
-  mfseek(f, 0, SEEK_END);
-  int size = mftell(f);
-  mfseek(f, saved_pos, SEEK_SET);
-  return size;
+	int saved_pos = mftell(f);
+	mfseek(f, 0, SEEK_END);
+	int size = mftell(f);
+	mfseek(f, saved_pos, SEEK_SET);
+	return size;
 }
 
 bool removeFile(const char* path)
 {
-  return _unlink(path)==0; //VS: "The POSIX name is deprecated. Instead, use the ISO C++ conformant name: _unlink"
+#ifdef _WIN32
+	return _wunlink(Convert::utf8ToUtf16(path).c_str()) == 0;
+#else
+	return _unlink(path) == 0; //VS: "The POSIX name is deprecated. Instead, use the ISO C++ conformant name: _unlink"
+#endif
 }
 
@@ -76,10 +92,6 @@
 {
 	if (fname == NULL) return false; //SplitFileSystem never passes NULL but this function is public so we never know
-#if defined _WIN32 && !defined SHP
- #ifdef __BORLANDC__
-	return PathIsRelative(fname) == FALSE; //no wide char for old borland compiler
- #else
-	return PathIsRelative(Convert::strTOwstr(fname).c_str()) == FALSE; //http://msdn.microsoft.com/en-us/library/bb773660%28v=vs.85%29.aspx
- #endif
+#if defined _WIN32
+	return PathIsRelativeW(Convert::utf8ToUtf16(fname).c_str()) == FALSE; //http://msdn.microsoft.com/en-us/library/bb773660%28v=vs.85%29.aspx
 #else
 	return fname[0] == PATH_SEPARATOR_CHAR;
