reddit/reddit — pull request #880 by andre-d (2013-08-12 11:40:18+00:00)
Title: filters: Fix html unknown html entities throwing exceptions.

Fixes html entities which do not exist like &afaf; raising exceptions while validating. Snudown is agnostic to the validity of entities beyond alphanumeric checks. I figured the fix was easy, ignore html entities while validating and let the browsers handle it like they do. Apparently not that simple, saxify started to error out if we did that. At first I thought this was a problem likely solved by a newer lxml, I updated lxml and it was indeed not fixed. Looking into it: saxify does not properly handle Entity elements (it treats them as if they are regular tags, unlike how it handles Comment entities). This pull request is a total hack fix.

I should likely submit a pull request to lxml with a fix. Like how they handle Comments they need to check for Entity and call skippedEntity on the ContentHandler.