kcc
kcc copied to clipboard
Filename change in Kobo profiles
Hi, I've been encountering this issue where with an input of a file with spaces and hyphens, those are deleted in the output file. For example : "One Piece - Chapter 4.cbz" will be named "OnePieceChapter4.kepub.epub".
This happens with any Kobo profile set as an option, maybe the kepub conversion does this. With a Kindle profile it works well and the filename is preserved (but not kepub).
I don't have a Kobo to test, but looks like intentional behavior. Not sure if spaces and special characters cause issues on older kobos
if 'Ko' in options.profile and options.format == 'EPUB':
path = srcpath.split(os.path.sep)
path[-1] = ''.join(e for e in path[-1].split('.')[0] if e.isalnum()) + tomenumber + ext
if not path[-1].split('.')[0]:
path[-1] = 'KCCPlaceholder' + tomenumber + ext
filename = os.path.sep.join(path)
https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/comic2ebook.py#L675
Looks like this can't be fixed to maintain compatibility with older devices. I don't have a Kobo however and can't confirm.
For compatibility with older reading systems, file names SHOULD NOT contain SPACE (U+0020) characters.
https://www.w3.org/TR/epub-33/#sec-container-filenames
The Kindle case is different since Kindles don't read EPUB natively, it's an intermediate format fed into KindleGen.
I think just removing or replacing special characters is the only option.
Unless we had a list of kobos that are confirmed compatible with spaces...
My Kobo reads .epub files just fine, also no problems with spaces whatsoever. I haven't read anything about kobo's not being able to read files with spaces especially as they run on pretty much the same software.
Where did you see this ?
Looks like this renaming code was added in response to
- #141
However, the discussion doesn't seem to blame the filename for the underlying issue so it might be safe to remove.
Which Kobo do you have?
I own the Kobo Clara HD
Want to create a PR with that code section deleted and testing that it works fine? I really don't see any indication that spaces cause problems on Kobo.