View Single Post
Old 03-16-2019, 02:27 PM   #1
mrprobert
Connoisseur
mrprobert began at the beginning.
 
Posts: 71
Karma: 46
Join Date: Mar 2017
Device: None
"Entity 'nbsp' not defined" error

Hello,

I got this error while importing an html file into Sigil:

"Entity 'nbsp' not defined".

The error was triggered by this line of code: <p>&nbsp;</p>. It's no big deal to fix the code so it will import without the error, but the way Sigil treated the error seemed kind of goofy, so I did a little investigating.

I found that a particular "toolbars" string in sigil.ini was the proximate cause of the error. Will someone kindly look at what I did and try to reproduce it? I think most people will not, but please bear with me.

Environment:
Sigil 0.9.12
Windows 10

Settings:
Create New or Empty Epubs as: Version 3
Mend XHTML Source Code On: Open and Save
Preserve Entities: &nbsp;

1. Run Sigil.

2. In the Code View pane you should see:

<?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>
<body>
<p>*</p>
</body>
</html>

So far, so good.

3. Toggle to book view, click on the book view pane [IMPORTANT!] and the resulting error is:

This page contains the following errors:
error on line 6 at column 10: Entity 'nbsp' not defined

4. The error message disappears when I toggle back to Code View, and reappears when I repeat step 3 above. I am guessing that this is normal behavior.

5. Mending the code doesn't make the error go away and I can save to an epub with no warning about nonconforming XHTML.

6. Next I deleted sigil.ini, ran Sigil, and set the prefs as above. No more errors.

7. I can reproduce the error by pasting the toolbars string from the original sigil.ini file into the new sigil.ini file.

Here is the suspect string:

toolbars=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x 3\0\0\0\0\0\0\x1%\0\0\x2\x45\xfc\x2\0\0\0\x2\xfb\0 \0\0\x16\0\x62\0o\0o\0k\0\x62\0r\0o\0w\0s\0\x65\0r \x1\0\0\0W\0\0\x2\x45\0\0\0]\0\xff\xff\xff\xfb\0\0\0\x16\0\x63\0l\0i\0p\0s\0w\ 0i\0n\0\x64\0o\0w\0\0\0\0\0\xff\xff\xff\xff\0\0\0]\0\xff\xff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xff\ 0\0\0\0\0\0\0\0\0\0\0\x2\0\0\0\x1\0\0\0\x18\0t\0o\ 0o\0l\0\x42\0\x61\0r\0\x43\0l\0i\0p\0s\0\0\0\0\0\x ff\xff\xff\xff\0\0\0\0\0\0\0\0)

8. I could also eliminate the error by keeping the original sigil.ini file in place and deleting &nbsp; from Preserve Entities. This probably worked because the toolbars string was modified in the process.

Thanks for reading.

- Mark
Attached Files
File Type: rar string.rar (621 Bytes, 232 views)
mrprobert is offline   Reply With Quote