From 1728429512a7bf0fec3b46480178e6cf59bb0000 Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Sun, 17 Aug 2008 18:12:27 +0200 Subject: [PATCH] taglib: Fix opening of filenames on non-UTF8 systems. Unfortunately taglib does not accept fd's or FILE*, so i ported the code from src/text/unicode.c open() to here. --- modules/meta_engine/taglib.cpp | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp index 67e54dd7e3..1845f6f91a 100644 --- a/modules/meta_engine/taglib.cpp +++ b/modules/meta_engine/taglib.cpp @@ -32,6 +32,13 @@ #include #include #include +#include + +#ifdef WIN32 +# include +#else +# include +#endif #include #include @@ -242,7 +249,30 @@ static int ReadMeta( vlc_object_t *p_this ) TAB_INIT( p_demux_meta->i_attachments, p_demux_meta->attachments ); p_demux_meta->p_meta = NULL; - FileRef f( p_demux->psz_path ); +#if defined(WIN32) || defined (UNDER_CE) + if(GetVersion() < 0x80000000) + { + wchar_t wpath[MAX_PATH + 1]; + if( !MultiByteToWideChar( CP_UTF8, 0, p_demux->psz_path, -1, wpath, MAX_PATH) ) + { + errno = ENOENT; + return VLC_EGENERIC; + } + wpath[MAX_PATH] = L'0'; + FileRef f( wpath ); + } + else return VLC_EGENERIC; +#else + const char *local_name = ToLocale( p_demux->psz_path ); + + if( local_name == NULL ) + { + return VLC_EGENERIC; + } + FileRef f( local_name ); + LocaleFree( local_name ); +#endif + if( f.isNull() ) return VLC_EGENERIC; -- 2.39.2