Page 1 of 1

[help]How to load a file with chinese-characters filename?

Posted: 18 Mar 2012 14:33
by freesunshine
I can't open video files with simple-chinese-characters filename in libvlc
My IDE is VC2010 MFC with unicode
I tried conversing it to utf-8 but failed.

Please HLEP ME! It kills me!!!

Re: [help]How to load a file with chinese-characters filenam

Posted: 18 Mar 2012 18:04
by Rémi Denis-Courmont
There must be a bug in your code or in your bindings. It works fine in VLC.

Re: [help]How to load a file with chinese-characters filenam

Posted: 18 Mar 2012 18:37
by freesunshine
Yes. It works in VLC,but i don't know how to make it in my code.
i need sample code. :(

Re: [help]How to load a file with chinese-characters filenam

Posted: 18 Mar 2012 22:22
by MichaelMc
Chinese and Japanese filepaths' both load/play just fine for me. Try pasting what you're currently doing.

Re: [help]How to load a file with chinese-characters filenam

Posted: 19 Mar 2012 06:01
by freesunshine
this is my origin code:

AXVLC::IVLCPlaylistPtr plo(reinterpret_cast<AXVLC::IVLCPlaylist*>(mVLC.get_playlist()), false);
CString file("file:///c:\你好.avi");
plo->add(file.GetString());
plo->play();

and it can't work;

someone told me that vlc only accept utf-8 strings,so i wrote this:

CStringA str(file);
USES_CONVERSION;
wchar_t* wszString = T2W(file.GetBuffer());
int u8Len = ::WideCharToMultiByte(CP_UTF8, NULL, wszString, wcslen(wszString), NULL, 0, NULL, NULL);
char* szU8 = new char[u8Len + 1];
::WideCharToMultiByte(CP_UTF8, NULL, wszString, wcslen(wszString), szU8, u8Len, NULL, NULL);
szU8[u8Len] = '\0';

AXVLC::IVLCPlaylistPtr plo(reinterpret_cast<AXVLC::IVLCPlaylist*>(mVLC.get_playlist()), false);
plo->add(szU8);
plo->play();

but still failed

Re: [help]How to load a file with chinese-characters filenam

Posted: 19 Mar 2012 10:57
by MichaelMc
"CString file("file:///c:\你好.avi");"

Why the single backslash?

Re: [help]How to load a file with chinese-characters filenam

Posted: 19 Mar 2012 16:25
by freesunshine
i tried CString file("file:///c:/你好.avi");but nothing changed :(

Re: [help]How to load a file with chinese-characters filenam

Posted: 20 Mar 2012 04:20
by freesunshine
can anybody help?

Re: [help]How to load a file with chinese-characters filenam

Posted: 20 Mar 2012 06:07
by RSATom
can you upload small .avi with "simple-chinese-characters filename" somewhere?

Re: [help]How to load a file with chinese-characters filenam

Posted: 20 Mar 2012 07:13
by freesunshine
http://mail.qq.com/cgi-bin/ftnExs_downl ... e=0a0b030a

my system is chinese vision,so i dont know what it look like in english vision or others.

Re: [help]How to load a file with chinese-characters filenam

Posted: 20 Mar 2012 11:37
by RSATom
file plays if use file:///C:/%E4%B8%AD%E6%96%87.avi name.
http://en.wikipedia.org/wiki/Percent-encoding

Re: [help]How to load a file with chinese-characters filenam

Posted: 20 Mar 2012 12:16
by freesunshine
it works!!!!!!!!!!!!
thank you soooooooooooooooooooooooooooooooo much!!!!!!!!!!!!!!!!

Re: [help]How to load a file with chinese-characters filenam

Posted: 20 Mar 2012 12:17
by freesunshine
thank u all! RSATom、 Rémi Denis-Courmont and MichaelMc