[okular] [Bug 458289] New: Table of Contents pages always point to page 1

Duane bugzilla_noreply at kde.org
Thu Aug 25 11:04:36 BST 2022


https://bugs.kde.org/show_bug.cgi?id=458289

            Bug ID: 458289
           Summary: Table of Contents pages always point to page 1
           Product: okular
           Version: 22.08.0
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: EPub backend
          Assignee: okular-devel at kde.org
          Reporter: duane-tech at evenson.ca
  Target Milestone: ---

Created attachment 151575
  --> https://bugs.kde.org/attachment.cgi?id=151575&action=edit
simple demonstration epub

SUMMARY
The toc.ncx content line references to filename as a URI (percent-encoded),
this breaks on Okular.
The solution is change Okular to decode the percent-encoded filename so it
references the right file in the epub zip.


STEPS TO REPRODUCE
1. create "c,.html"
<html><body><h1>Chapter 1</h1><h1>Chapter 2</h1></body></html>
2. use 
ebook-convert "c,.html" "c,.epub" --no-default-epub-cover
to create a new epub
3. open in Okular

OBSERVED RESULT
All pages in the TOC point to page 1

EXPECTED RESULT
Different entries should have different pages (1, 2, etc.)

SOFTWARE/OS VERSIONS
Linux: Arch Linux 5.19.3-arch1-1

ADDITIONAL INFORMATION
In the above example, within the epub zip, ebook-convert creates
c,_split_000.html and c,_split_001.html
toc.ncx:
The spec for the table of contents file, toc.ncx, are to use URI for the
references to the files[1] which requires percent encoding for all characters
other than [a-zA-Z0-9-._~][2][3]
the toc.ncx file has the line:
      <content src="c%2c_split_000.html"/>
I suspect Okular is looking for the file "c%2c_split_000.html" instead of
"c,_split_000.html" and not finding it, places a 1 for the page number.
Hand-editing the toc.ncx file so it has the line:
      <content src="c,_split_000.html"/>
allows Okular to work right, but the epub then is not standard.
The solution is change Okular to decode the percent-encoded file name so it
references the right file.

references:
[1]  see <content> section in
https://daisy.org/activities/standards/daisy/daisy-3/z39-86-2005-r2012-specifications-for-the-digital-talking-book/#NCXElem
[2]  go to paragraphs with "percent-encoded" in
https://en.wikipedia.org/wiki/Uniform_Resource_Identifier
[3]  https://www.rfc-editor.org/rfc/rfc3986#page-12

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list