Open zby1234 opened 6 years ago
Hi ! You are right, I forced the "--restrict-filenames" option. Since I'm currently working on a new version, very different from the current published version, I won't fix this issue in current version. However, you could try to comment the following line (not tested, your system must properly support UTF-8): https://github.com/Kallys/MediaDownloader/blob/50c1730dcddf6e830717f0e03aa3649f35bd5d37/lib/Downloader.php#L195 (Help: add a double slash "//" at the beginning of the line 195 of file lib/Downloader.php)
I deleted line 195 in Downloader.php but it didn't work. I've tested on ubuntu 14.04 and 16.04 which support utf-8(rename filename manually it shows chinese and japanese normally), and I change ffmpeg to avconv and php version to 7.1 also force youtube-dl use python3.4 but failed.
Ok, I found the issue : PHP shell environment uses non-unicode locale by default ('C' locale).
So a quick and dirty fix for you is to edit lib/Downloader.php file and replace line 195 by following lines of code:
// Hack for UTF8 chars in filenames
$locale = 'fr_FR.UTF-8';
setlocale(LC_ALL, $locale);
putenv('LC_ALL='.$locale);
// $cmd .= " --restrict-filenames"; // --restrict-filenames is for specials chars
I used the "fr_FR.UTF-8" locale as example, but you should use the same as your system. (Type "locale" in terminal to print your current locale settings)
Thank you! it works. By the way I find that "Let me choose" option only support standard URL format like 'https://www.youtube.com/watch?v=videoID' and 'https://youtu.be/videoID'. some URL like 'https://www.youtube.com/watch?v=videoID&list=playlistID&index=' will return error info.
Sorry to trouble you. It seems that youtube-dl-webUI use "--restrict-filenames" option by default because I can only see ASCII characters in file names(English and numbers). I don't know how to make it show Chinese or Japanese normally. e.p. https://www.youtube.com/watch?v=DON-bB_zqwM title: "リルリルフェアリル~魔法の鏡~「メガネティーチャーのフェアリル歴史学」他 " file name: "_-TVTOKYO.mp4"