(self, name)
| 68 | self.soup.handle_data(data) |
| 69 | |
| 70 | def handle_charref(self, name): |
| 71 | # XXX workaround for a bug in HTMLParser. Remove this once |
| 72 | # it's fixed in all supported versions. |
| 73 | # http://bugs.python.org/issue13633 |
| 74 | if name.startswith('x'): |
| 75 | real_name = int(name.lstrip('x'), 16) |
| 76 | elif name.startswith('X'): |
| 77 | real_name = int(name.lstrip('X'), 16) |
| 78 | else: |
| 79 | real_name = int(name) |
| 80 | |
| 81 | try: |
| 82 | data = chr(real_name) |
| 83 | except (ValueError, OverflowError) as e: |
| 84 | data = "\N{REPLACEMENT CHARACTER}" |
| 85 | |
| 86 | self.handle_data(data) |
| 87 | |
| 88 | def handle_entityref(self, name): |
| 89 | character = EntitySubstitution.HTML_ENTITY_TO_CHARACTER.get(name) |
nothing calls this directly
no test coverage detected