Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: A more robust solution for truncating file names #5921

Open
yan12125 opened this issue Jun 7, 2015 · 5 comments
Open

Proposal: A more robust solution for truncating file names #5921

yan12125 opened this issue Jun 7, 2015 · 5 comments

Comments

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 7, 2015

Currently in this line, info_dict['title'] is truncated to 200 characters. This is first done by @phihag in 0599ef8. This implementation can't handle wide characters correctly. An examples are #5740. I think YoutubeDL should switch to a utf-8 friendly implementation.

There's an implementation at a stackoverflow answer, although I haven't tested it. Any opinions?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jun 7, 2015

As an addition: it still may not be enough since max filename limitation in general can be arbitrary (see #5908).

@yan12125
Copy link
Collaborator Author

@yan12125 yan12125 commented Jun 8, 2015

Another side note: on Windows file system encoding is not always utf-8, which make thinks more complicated. For example, on Traditional Chinese Windows file system uses big5 (cp950), where each Chinese character occupies 2 bytes rather than 3 bytes in utf-8.

@Invertex
Copy link

@Invertex Invertex commented Jan 2, 2020

This is still an issue, at least in Windows, and can be further exacerbated depending on the character length of the directory path that youtube-dl is outputting files in. --restrict-filenames doesn't trim it and there's no option to truncate the filename either still. A simple -truncate ## parameter would suffice just fine, or perhaps even an auto value that checks total file path length.

@shillshocked
Copy link

@shillshocked shillshocked commented Jan 3, 2020

Also an issue in Linux, and moderator keeps closing new issues on this without referencing or addressing the original issue.

@wizzup
Copy link

@wizzup wizzup commented Jan 11, 2020

I've got the same error message, add here for reference and seaching

#23702

@ytdl-org ytdl-org locked and limited conversation to collaborators Jan 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.