Hi there!
First of all, thanks for the wonderful tool!
Found a bug in mobi_header.py, namely: The contents of header 208 (watermark) is dumped as a string into the generated .opf. Since under certain circumstances it
can contain code points outside of the range allowable in XML, in those cases the resulting .opf becomes invalid.
The fix is very simple--it just involves moving 208 from id_map_strings to id_map_hexstrings. Sample patch against 0.73 below.
Code:
--- mobi_header.py.orig 2014-07-14 18:32:44.000000000 +0300
+++ mobi_header.py 2014-08-23 00:50:43.312531211 +0300
@@ -71,7 +71,6 @@
129 : 'K8_Masthead/Cover_Image_(129)',
132 : 'RegionMagnification_(132)',
200 : 'DictShortName_(200)',
- 208 : 'Watermark_(208)',
501 : 'cdeType_(501)',
502 : 'last_update_time_(502)',
503 : 'Updated_Title_(503)',
@@ -113,6 +112,7 @@
404 : 'Text_to_Speech_Disabled_(404)',
}
id_map_hexstrings = {
+ 208 : 'Watermark_(208_in_hex)',
209 : 'Tamper_Proof_Keys_(209_in_hex)',
300 : 'Font_Signature_(300_in_hex)',
}
@@ -370,7 +370,6 @@
129 : 'K8(129)_Masthead/Cover_Image',
132 : 'RegionMagnification',
200 : 'DictShortName',
- 208 : 'Watermark',
501 : 'cdeType',
502 : 'last_update_time',
503 : 'Updated_Title',
@@ -412,6 +411,7 @@
406 : 'Rental_Indicator',
}
id_map_hexstrings = {
+ 208 : 'Watermark (hex)',
209 : 'Tamper Proof Keys (hex)',
300 : 'Font Signature (hex)',
403 : 'Unknown_(403) (hex)',