Review Request: Add HTML entity resolving to KNotify's XML-based HTML stripper

Sjors Gielen dazjorz at dazjorz.com
Thu Sep 9 23:46:02 BST 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/5229/
-----------------------------------------------------------

(Updated 2010-09-09 22:46:01.603872)


Review request for kdelibs and Olivier Goffart.


Changes
-------

Use the entry database in kdelibs, KCharsets::fromEntity. Much better, thanks Maksim :)

(This patch is known to compile, but still requires some more extensive testing before committing.)


Summary
-------

This patch adds HTML entity resolving.
The HTML stripper that I previously patched in KNotify is actually an XML stripper; this is not much of a problem except many HTML entities like   are not valid in XML, making the parser fail; this has the effect that a message from an application with one such entity in it, is displayed as plain HTML, instead of the stripped message.
This patch adds a HtmlEntityResolver class and makes the XML stripper use it to resolve additional entities. The   which would have caused an XML error, is now turned into a regular space, fixing the problem. (Any unknown HTML entities are currently replaced with an empty string.)

I placed HtmlEntityResolver inside NotifyByPopup because it is such a small class, but if I am going to add *all* HTML entities (there's a lot of them), I think it would be best to split the file off into its own class (unless there's a better class to use for this).

I think this patch should be backported to KDE 4.5 because it fixes an important bug.


Diffs (updated)
-----

  /trunk/KDE/kdebase/runtime/knotify/notifybypopup.h 1173644 
  /trunk/KDE/kdebase/runtime/knotify/notifybypopup.cpp 1173644 

Diff: http://svn.reviewboard.kde.org/r/5229/diff


Testing
-------

Compiles and works on Mac OS X (tested with the Growl patch in 4.6 trunk). Only tested with  , not with other HTML entities, or a mix of HTML and XML entities.


Thanks,

Sjors

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20100909/45b91cd7/attachment.htm>


More information about the kde-core-devel mailing list