yausername / dvd

Download videos from anywhere
GNU General Public License v3.0
869 stars 44 forks source link

Possible file creation failure for filename in CJK in UTF-8 #76

Open gujm opened 2 years ago

gujm commented 2 years ago

I found the filename length issue still exists when processing long titles in CJK languages.

31 createFilename() in class FileNameUtils uses string.length() to ensure the file name is less than 127. However, when the title is in CJK language in UTF-8 format, length() checks the number of characters instead of bytes. Although the CJK title may be of less than 127 characters, the number of bytes it occupies could exceed 255.

Perhaps String.getBytes().length be to used but with proper truncation of UTF-8 string? Thanks