kcc icon indicating copy to clipboard operation
kcc copied to clipboard

Filename change in Kobo profiles

Open hvmzx opened this issue 8 months ago • 6 comments

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).

hvmzx avatar Nov 05 '23 10:11 hvmzx

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

axu2 avatar Nov 11 '23 16:11 axu2

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

axu2 avatar Dec 12 '23 04:12 axu2

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 ?

hvmzx avatar Dec 28 '23 18:12 hvmzx

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?

axu2 avatar Dec 28 '23 23:12 axu2

I own the Kobo Clara HD

hvmzx avatar Dec 28 '23 23:12 hvmzx

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.

axu2 avatar Jan 04 '24 18:01 axu2