Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 08-24-2011, 04:22 AM   #1
itimpi
Wizard
itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.
 
Posts: 4,552
Karma: 950151
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
Is Comments field XHTML compliant?

I am looking at an issue in the calibre2opds software that relates to our handling of the Calibre Comments field when it contains characters outside the cp1252 character set. What we are finding is these characters are ending up displaying incorrectly in our generated catalogs.

At the moment we have some code that uses 3rd party libraries to 'tidy' the Comments field and ensure it is XHTML compliant for inclusion into an OPDS catalog. This code dates from the days before Calibre properly supported HTML comments which was why it was originally used. We have tracked down our issue to the fact that the library we are using does not seem to be handling the comments field correctly if contains these non-cp1252 characters. Before we try and 'tidy' the comments field it is correctly stored in Java (which uses UTF-16 strings). If we by-pass the tidy code then the problem goes away and our generated catalogs display correctly.

The question therefore is whether it is now safe to assume that the Calibre comments field read from the database is already XHTML compliant? If we can then a lot of work can be avoided in calibre2opds to fix code that is no longer needed.
itimpi is offline   Reply With Quote
Old 08-24-2011, 06:51 AM   #2
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
I don't know the answer but a simple test would be to put non-xhtml compliant data into a comment. Then when it is exported check the data against the XHTML scheme and see if it passes.
user_none is offline   Reply With Quote
Advert
Old 08-24-2011, 12:18 PM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No, there is no such guarantee. But if I were you, I wouldn't worry about XHTML compliance. Just stick the html into a webpage, I seriously doubt any browser will have difficulty displaying it as long as you dont declare the page to be XHTML compliant.

Alternatively, duplicate the comments_to_html function from calibre, that is what calibre uses when inserting the contents of html fields into epub/content server pages.
kovidgoyal is offline   Reply With Quote
Old 08-24-2011, 12:46 PM   #4
itimpi
Wizard
itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.
 
Posts: 4,552
Karma: 950151
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
Quote:
Originally Posted by kovidgoyal View Post
No, there is no such guarantee. But if I were you, I wouldn't worry about XHTML compliance. Just stick the html into a webpage, I seriously doubt any browser will have difficulty displaying it as long as you dont declare the page to be XHTML .
Note that we are talking bout an OPDS compatible client here - not a browser. I thought the OPDS standard mandated that the comments field had to be XHTML compliant in an OPDS catalog? However if you reckon that it does not seem to matter, I am happy to run with that as a working assumption.
itimpi is offline   Reply With Quote
Old 08-24-2011, 12:52 PM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It doesn't have to be XHTML compliant, just valid XML.
kovidgoyal is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PRS-600 PRS-600, calibre and comments field mfabry Sony Reader 0 12-18-2010 06:41 AM
Comments In XHTML? Fabe Sigil 6 11-30-2010 03:25 AM
Comments field emeybee Calibre 1 05-27-2010 02:01 PM
Comments field banjomike Calibre 7 04-08-2010 02:18 PM
Comments field hyperact Calibre 3 12-28-2008 01:38 PM


All times are GMT -4. The time now is 10:49 AM.


MobileRead.com is a privately owned, operated and funded community.