tymofij / fb2reader

FB2 Reader Firefox Addon
https://addons.mozilla.org/firefox/addon/fb2-reader/
21 stars 5 forks source link

BOM in the beginning of the file prevents FB2 from being parsed. #7

Open the-vindicar opened 5 years ago

the-vindicar commented 5 years ago

File examples.zip contains two samples: success.fb2 will be successuly loaded by the extension, and fail.fb2 will not. Snapshot of this behaviour is attached. Since Byte Order Mark can be a valid part of text stream, I suggest that the plugin attempts to accomodate for it's presence. snapshot

tymofij commented 4 years ago

Remote http:// fail.fb2 file opened without any issue. When saved locally, through, using file:// protocol indeed it fails to be parsed.

The extension relies on Firefox's ability to open local XML files as XML, even when they are not named this way. When the extension was turned off completely, Firefox was able to open success.fb2 as an XML file, but opened fail.fb2 file as a plaintext one.

That opening the file as text/plain instead of text/xml requires rethinking the logic of local file handling.

tymofij commented 3 years ago

Bugzilla Automatic content detection doesn't work for XML Files with Byte Order Mark (BOM)