diff --git a/linphone/mediastreamer2/src/msfileplayer_win.c b/linphone/mediastreamer2/src/msfileplayer_win.c
index cd8e4bd333f9cd304f54050e4f94a4b7059c00e7..0007b7a2adf1dfb1a6687fcc5f4444991ea8a1ba 100644
--- a/linphone/mediastreamer2/src/msfileplayer_win.c
+++ b/linphone/mediastreamer2/src/msfileplayer_win.c
@@ -17,11 +17,12 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 
+#define UNICODE
+
 #include "mediastreamer2/msfileplayer.h"
 #include "mediastreamer2/waveheader.h"
 #include "mediastreamer2/msticker.h"
 
-
 typedef enum {
 	CLOSED,
 	STARTED,
@@ -127,26 +128,18 @@ static int read_wav_header(PlayerData *d){
 static int player_open(MSFilter *f, void *arg){
 	PlayerData *d=(PlayerData*)f->data;
 	HANDLE fd;
-	const char *afile=(const char*)arg;
-	LPCTSTR file;
-#ifdef _UNICODE
-	wchar_t wfile[MAX_PATH];
-	mbstowcs(wfile,afile,MAX_PATH);
-	file=wfile;
-#else
-	file=afile;
-#endif
-
-    fd = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL,
-        OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-
+	const char *file=(const char*)arg;
+	WCHAR wUnicode[1024];
+	MultiByteToWideChar(CP_UTF8, 0, file, -1, wUnicode, 1024);
+    fd = CreateFile(wUnicode, GENERIC_READ, FILE_SHARE_READ, NULL,
+        OPEN_EXISTING, 0, NULL);
 	if (fd==INVALID_HANDLE_VALUE){
-		ms_warning("Failed to open %s: error %i",afile,GetLastError());
+		ms_warning("Failed to open %s",file);
 		return -1;
 	}
 	d->state=STOPPED;
 	d->fd=fd;
-	if (strstr(afile,".wav")!=NULL) read_wav_header(d);
+	if (strstr(file,".wav")!=NULL) read_wav_header(d);
 	return 0;
 }
 
diff --git a/linphone/mediastreamer2/src/msfilerec_win.c b/linphone/mediastreamer2/src/msfilerec_win.c
index 85df07b862d3262e0ed3a54138a4f8168ff6491e..b485d451bf835253b393966ef9396e91de2eb661 100644
--- a/linphone/mediastreamer2/src/msfilerec_win.c
+++ b/linphone/mediastreamer2/src/msfilerec_win.c
@@ -17,6 +17,8 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 
+#define UNICODE
+
 #include "mediastreamer2/msfilerec.h"
 #include "mediastreamer2/waveheader.h"
 
@@ -84,6 +86,9 @@ static void write_wav_header(int rate,int size, char *filename){
 	wave_header_t header;
 	DWORD bytes_written=0;
 	HANDLE fd;
+	WCHAR wUnicode[1024];
+	MultiByteToWideChar(CP_UTF8, 0, filename, -1, wUnicode, 1024);
+
 	memcpy(&header.riff_chunk.riff,"RIFF",4);
 	header.riff_chunk.len=le_uint32(size+32);
 	memcpy(&header.riff_chunk.wave,"WAVE",4);
@@ -101,11 +106,7 @@ static void write_wav_header(int rate,int size, char *filename){
 	header.data_chunk.len=le_uint32(size);
 
 	/* TODO: replace with "lseek" equivalent for windows */
-#if defined(_WIN32_WCE)
-	fd=CreateFile((LPCWSTR)filename, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
-#else
-	fd=CreateFile(filename, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
-#endif
+	fd=CreateFile(wUnicode, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
 	if (fd==INVALID_HANDLE_VALUE){
 #if !defined(_WIN32_WCE)
 		ms_warning("Cannot open %s: %s",filename,strerror(errno));
@@ -127,13 +128,12 @@ static int rec_open(MSFilter *f, void *arg){
 
 	RecState *s=(RecState*)f->data;
 	const char *filename=(const char*)arg;
+	WCHAR wUnicode[1024];
+	MultiByteToWideChar(CP_UTF8, 0, filename, -1, wUnicode, 1024);
+
 	ms_mutex_lock(&f->lock);
 	snprintf(s->filename, sizeof(s->filename), "%s", filename);
-#if defined(_WIN32_WCE)
-	s->fd=CreateFile((LPCWSTR)filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
-#else
-	s->fd=CreateFile(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
-#endif
+	s->fd=CreateFile(wUnicode, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
 	if (s->fd==INVALID_HANDLE_VALUE){
 #if !defined(_WIN32_WCE)
 		ms_warning("Cannot open %s: %s",filename,strerror(errno));
diff --git a/linphone/mediastreamer2/src/winsndds.cpp b/linphone/mediastreamer2/src/winsndds.cpp
index 8d6b22ad8edc72683cd857fcf807d1a9341007f6..fe539fe8e528eed5af584fc4907d990bdf8f98e1 100644
--- a/linphone/mediastreamer2/src/winsndds.cpp
+++ b/linphone/mediastreamer2/src/winsndds.cpp
@@ -19,12 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #ifdef __DIRECTSOUND_ENABLED__
 
+#define UNICODE
+
 #include "mediastreamer2/mssndcard.h"
 #include "mediastreamer2/msfilter.h"
 #include "mediastreamer2/msticker.h"
 
-#define UNICODE
-
 #include <mmsystem.h>
 #ifdef _MSC_VER
 #include <mmreg.h>
@@ -1045,7 +1045,7 @@ static void _winsnddscard_detect(MSSndCardManager *m){
 
 	if (ms_lib_instance==NULL)
 	{
-		ms_lib_instance = LoadLibrary("dsound.dll");
+		ms_lib_instance = LoadLibrary(L"dsound.dll");
 		if( ms_lib_instance == NULL )
 		{
 			/* error */