summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f929076)
* fixes handling of numeric entities
* fixes unittest for entities.
self.opentags.append(u'p')
self.curdata = self.curdata + data.decode("utf-8")
self.opentags.append(u'p')
self.curdata = self.curdata + data.decode("utf-8")
+ def handle_charref(self, name):
+ entity = unichr(int(name))
+ self.curdata = self.curdata + unicode(entity.encode('utf-8'), \
+ "utf-8")
+
def handle_entityref(self, name):
entity = name
if HTML2Text.entities.has_key(name):
entity = HTML2Text.entities[name]
def handle_entityref(self, name):
entity = name
if HTML2Text.entities.has_key(name):
entity = HTML2Text.entities[name]
- elif name[0] == "#":
- entity = unichr(int(name[1:]))
else:
entity = "&" + name + ";"
else:
entity = "&" + name + ";"
-<p>áÞö</p>
+<p>áÞö’</p>
def suite():
suite = unittest.TestSuite()
def suite():
suite = unittest.TestSuite()
- suite.addTest(SpacingTests("testEntities"))
+ suite.addTest(EntityTests("testEntities"))
return suite
if __name__ == "__main__":
return suite
if __name__ == "__main__":