![]() |
#1 |
Enthusiast
![]() Posts: 31
Karma: 10
Join Date: Jun 2011
Location: Lima, Peru
Device: Kindle 10Gen / Kobo Aura HD / Nook STR
|
![]()
Hello everyone.
First, thanks to the developers for their work on this great tool. ![]() I have had this doubt for a long time (epub3): Why is the header of the nav file different from the rest of xhtml files? Section0001.xhtml Code:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"> <head> <title></title> </head> Code:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="es" xml:lang="es"> <head> <title>ePub NAV</title> <meta charset="utf-8"/> <link href="../Styles/sgc-nav.css" rel="stylesheet" type="text/css"/> </head> 1. Why is the 'charset' line added only in nav? Is the 'encoding' of the first line not enough? If the answer above is "no": -Why isn't it added to the rest of the xhtml files? -Shouldn't it be before the < title >, in case it has 'special' characters? (in previous versions of Sigil it was like this.) 2. Why are language tags added only in nav? (in my books, by default in Spanish.) Same case above: shouldn't they be automatically added to all xhtml? 3. (epub2): I know that language tags do need to be added (at least 'xml:lang="es"'), but should 'charset' be added as well? (toc + xhtmls) 4. Finally, if I may compare, Calibre Editor automatically adds this initial line to each CSS: Code:
@charset "utf-8"; (Actually, in real life, I've only seen it in Standard Ebooks... ![]() Thank you so much! (and sorry for the automatic translation.) ![]() |
![]() |
![]() |
![]() |
#2 | ||
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,439
Karma: 5702578
Join Date: Nov 2009
Device: many
|
1. The charset is set in the nav as a backup encoding declaration since nav's are machine parsed to create the toc much like the old ncx was (ie act in a stand alone manner) and that parsing software is not always robust depending on the e-reader. Placement before or after the title is not relevant. Typically it is grepped for in the first 1024 characters by software that tries to guess character encoding.
2. language can be determined for all xhtml pages from the opf first dc:language metadata tag and if the xhtml only uses a single language this is all that should be needed. Accessibility has now made adding it more important as screen reading software typically does not grok the opf. So adding xml:lang and lang attributes to tags when specifying a language being used is always a good idea for accessibility reasons. Again this is added for the nav as it is independently machine parsed to extract landmarks and toc info by specific e-reader device software and should stand up on its own as a backup.. If you want to automate adding lang attributes as part of Sigil for all xhtml pages, you can easily do that in Sigil using plugins (Access-Aide), or just specify your own default xhtml file template (see our latest user guide for details) or just use global find and replace once at the end. 3. not unless that xhtml is meant to stand alone outside of the opf or epub. The xml header specifies the encoding. But support for anything other than utf-8, utf-16 ((le or be) and utf-32 has been long deprecated and the final 2 should use byteorder marks that determine / identify them. All other 8 bit encodes should be transcoded to utf-8 properly before adding them to your xhtml file. Here is what the w3c says about xml/xhtml and the use of charset: Quote:
Quote:
Last edited by KevinH; 01-18-2024 at 11:11 AM. |
||
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Enthusiast
![]() Posts: 31
Karma: 10
Join Date: Jun 2011
Location: Lima, Peru
Device: Kindle 10Gen / Kobo Aura HD / Nook STR
|
KevinH, sorry for the late reply.
Thank you very much for your kind and clear answers. Best regards! ![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
using nav.xhtml for TOC | hobnail | Sigil | 40 | 11-12-2021 02:00 PM |
Link to nav.xhtml in TOC | cges30901 | Sigil | 11 | 01-22-2020 12:01 PM |
Doubt about nav.xhtml and editor | Terisa de morgan | Editor | 5 | 08-12-2018 11:51 AM |
TOC nav.xhtml issue | ebookscovers | Conversion | 1 | 05-06-2017 11:12 AM |