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

This forum is about all development around libVLC.
freesunshine
Blank Cone
Blank Cone
Posts: 32
Joined: 18 Mar 2012 13:37

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

Postby freesunshine » 18 Mar 2012 14:33

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!!!

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

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

Postby Rémi Denis-Courmont » 18 Mar 2012 18:04

There must be a bug in your code or in your bindings. It works fine in VLC.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

freesunshine
Blank Cone
Blank Cone
Posts: 32
Joined: 18 Mar 2012 13:37

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

Postby freesunshine » 18 Mar 2012 18:37

Yes. It works in VLC,but i don't know how to make it in my code.
i need sample code. :(

MichaelMc
Blank Cone
Blank Cone
Posts: 63
Joined: 10 Jun 2009 17:55

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

Postby MichaelMc » 18 Mar 2012 22:22

Chinese and Japanese filepaths' both load/play just fine for me. Try pasting what you're currently doing.

freesunshine
Blank Cone
Blank Cone
Posts: 32
Joined: 18 Mar 2012 13:37

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

Postby freesunshine » 19 Mar 2012 06:01

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

MichaelMc
Blank Cone
Blank Cone
Posts: 63
Joined: 10 Jun 2009 17:55

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

Postby MichaelMc » 19 Mar 2012 10:57

"CString file("file:///c:\你好.avi");"

Why the single backslash?

freesunshine
Blank Cone
Blank Cone
Posts: 32
Joined: 18 Mar 2012 13:37

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

Postby freesunshine » 19 Mar 2012 16:25

i tried CString file("file:///c:/你好.avi");but nothing changed :(

freesunshine
Blank Cone
Blank Cone
Posts: 32
Joined: 18 Mar 2012 13:37

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

Postby freesunshine » 20 Mar 2012 04:20

can anybody help?

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

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

Postby RSATom » 20 Mar 2012 06:07

can you upload small .avi with "simple-chinese-characters filename" somewhere?

freesunshine
Blank Cone
Blank Cone
Posts: 32
Joined: 18 Mar 2012 13:37

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

Postby freesunshine » 20 Mar 2012 07:13

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.

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

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

Postby RSATom » 20 Mar 2012 11:37

file plays if use file:///C:/%E4%B8%AD%E6%96%87.avi name.
http://en.wikipedia.org/wiki/Percent-encoding

freesunshine
Blank Cone
Blank Cone
Posts: 32
Joined: 18 Mar 2012 13:37

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

Postby freesunshine » 20 Mar 2012 12:16

it works!!!!!!!!!!!!
thank you soooooooooooooooooooooooooooooooo much!!!!!!!!!!!!!!!!

freesunshine
Blank Cone
Blank Cone
Posts: 32
Joined: 18 Mar 2012 13:37

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

Postby freesunshine » 20 Mar 2012 12:17

thank u all! RSATom、 Rémi Denis-Courmont and MichaelMc


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 5 guests