05-19-2019, 04:39 PM | #1 |
Wizard
Posts: 1,086
Karma: 6719822
Join Date: Jul 2012
Device: Palm Pilot M105
|
entity replacements gone haywire
I had an em dash, written in the format "ampersand pound sign 8212 semicolon" and every time I opened or saved it was replacing the ampersand with & so that after awhile I ended up with
&a mp;amp;amp;amp;amp;amp;amp;amp;#8212; I've since turned off the Mend XHTML source code on open and save as a workaround. I looked at my sigil.ini and it has preserve_entity_names="*", "©", "&", "—" preserve_entity_codes=\xa0\xa9&\x2014 (The web page forum software here replaced the entity codes above; in my sigil.ini they are in the "ampersand pound sign number semicolon" format. The first one, the asterisk, is number 160 in my sigil.ini file.) In my preferences I have it set to create new epubs as version 3, validation levels for css are set to 3 for both. Sigil version 5.11.2. Last edited by lumpynose; 05-19-2019 at 04:55 PM. |
05-19-2019, 05:01 PM | #2 |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
@lumpynose
For some reason Sigil doesn't like the decimal notation of the em dash (—) but the hexadecimal equivalent — will survive if you add it to the Entities to Preserve list. |
Advert | |
|
05-19-2019, 05:04 PM | #3 | |
Wizard
Posts: 1,086
Karma: 6719822
Join Date: Jul 2012
Device: Palm Pilot M105
|
Quote:
Is octal also an option? Or maybe even binary? But thanks, that's one to remember. |
|
05-19-2019, 05:09 PM | #4 |
Wizard
Posts: 1,086
Karma: 6719822
Join Date: Jul 2012
Device: Palm Pilot M105
|
Dammit, it won't let me use &#A9; or &#A0;, apparently only numerics.
|
05-19-2019, 05:11 PM | #5 |
Wizard
Posts: 1,086
Karma: 6719822
Join Date: Jul 2012
Device: Palm Pilot M105
|
I wish sigil had 2 colums for that preserve entities window; the 2nd column for a comment saying what that gibberish in the first column means.
|
Advert | |
|
05-19-2019, 05:50 PM | #6 |
Grand Sorcerer
Posts: 27,550
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
EPUB3 (html5) is numeric-only for entities. That's a spec thing.
|
05-19-2019, 05:52 PM | #7 |
Wizard
Posts: 1,086
Karma: 6719822
Join Date: Jul 2012
Device: Palm Pilot M105
|
So what am I doing wrong? I had to remove all of the numeric entities from my preferences in the Entities to Preserve window, otherwise it was mangling them and replacing the ampersands with amp; and whatnot.
|
05-19-2019, 05:56 PM | #8 |
Wizard
Posts: 1,086
Karma: 6719822
Join Date: Jul 2012
Device: Palm Pilot M105
|
In my xhtml files whenever I use the form "ampersand pound sign 38 semicolon" and save and reopen the file, sigil replaces that with "ampersand amp semicolon". In my preferences the Entities to Save is empty.
|
05-19-2019, 06:05 PM | #9 |
Wizard
Posts: 1,086
Karma: 6719822
Join Date: Jul 2012
Device: Palm Pilot M105
|
If I put "& # 38 ;" and "& amp ;" in the entities to preserve and then use "& # 38 ;" in the text, when I open the file it's replaced with &. (Remove the spaces from the quoted stuff.)
Last edited by lumpynose; 05-19-2019 at 06:07 PM. |
05-19-2019, 06:08 PM | #10 |
Grand Sorcerer
Posts: 27,550
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
What version of Sigil? What O.S.?
(5.11.2 is the Qt5 version, not a Sigil version number) I don't have any trouble with the latest Sigil using entities. Perhaps your Sigil.ini file is corrupt. Back it up, delete it (or rename it) and relaunch Sigil so it generates a new one. See if that fixes the issue. You really shouldn't have an empty Preserve Entities list. The bare minimum is   (for EPUB3) and (for EPUB2). That's why is added by default. Bad things can happen if you run without one or the other (though I've never encountered the issues you're describing). The next versions of Sigil will be able to run without any entries in the Preserve Entities list. |
05-19-2019, 06:09 PM | #11 |
Wizard
Posts: 1,086
Karma: 6719822
Join Date: Jul 2012
Device: Palm Pilot M105
|
My xhtml file starts with
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"> Code:
<?xml version="1.0" encoding="utf-8"?> <package version="3.0" unique-identifier="BookId" xmlns="http://www.idpf.org/2007/opf"> |
05-19-2019, 06:10 PM | #12 |
Wizard
Posts: 1,086
Karma: 6719822
Join Date: Jul 2012
Device: Palm Pilot M105
|
Oops, sorry about the version number, and I thought I was being so careful about that.
Version 0.9.13, Build time 2019.03.21, Windows 10. |
05-19-2019, 06:12 PM | #13 |
Grand Sorcerer
Posts: 27,550
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
That's news to me I just fired up an older and newer version of Sigil on Windows/Linux and had no trouble with — being in the Preserve Entities list (and being correctly preserved when saving/opening/mending xhtml).
|
05-19-2019, 06:16 PM | #14 |
Wizard
Posts: 1,086
Karma: 6719822
Join Date: Jul 2012
Device: Palm Pilot M105
|
Nope, after deleting the sigil.ini file it's still replacing "& # 38 ;" with "& amp ;" when I open the file.
|
05-19-2019, 06:16 PM | #15 |
Grand Sorcerer
Posts: 27,550
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
My guess is that you're trying to enter entities in Book View. That would certainly result in the mess you're describing. If so ... don't do that. Entities are code and should only be entered in Code View.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Converting Google Translate Html -> Epub Can Make Calibre Go Haywire | MarjaE | Conversion | 1 | 05-09-2016 02:59 AM |
Readers go haywire when new? | susaz | General Discussions | 19 | 11-13-2013 07:48 AM |
Find and replace entity | roger64 | Sigil | 3 | 10-12-2012 10:13 AM |
The entity name must immediately follow the '&' in the entity reference | digireads | Calibre | 3 | 06-08-2010 10:31 PM |
ToC going haywire | JaneFancher | Calibre | 2 | 04-09-2010 10:03 PM |