Web: Add support for charrefs. Closes GH-923.

This commit is contained in:
Valentin Lorentz 2014-12-11 09:59:08 +01:00
parent 95c15922e4
commit ba12692fb4
2 changed files with 7 additions and 0 deletions

View File

@ -70,6 +70,10 @@ class Title(HTMLParser.HTMLParser):
if name in self.entitydefs:
self.title += self.entitydefs[name]
def handle_charref(self, name):
if self.inTitle:
self.title += unichr(int(name))
class DelayedIrc:
def __init__(self, irc):
self._irc = irc

View File

@ -65,6 +65,9 @@ class WebTestCase(ChannelPluginTestCase):
# Checks that the parser doesn't hang on invalid tags
self.assertNotError(
'title http://www.youtube.com/watch?v=x4BtiqPN4u8')
self.assertResponse(
'title http://www.thefreedictionary.com/don%27t',
"don't - definition of don't by The Free Dictionary")
def testTitleSnarfer(self):
try: