diff --git a/matrix/colors.py b/matrix/colors.py index 0c080ff..247c8f0 100644 --- a/matrix/colors.py +++ b/matrix/colors.py @@ -32,6 +32,8 @@ try: except ImportError: from html.parser import HTMLParser +from html.entities import name2codepoint + FormattedString = namedtuple('FormattedString', ['text', 'attributes']) quote_wrapper = textwrap.TextWrapper( @@ -314,6 +316,10 @@ class MatrixHtmlParser(HTMLParser): self.substrings = [] # type: List[FormattedString] self.attributes = DEFAULT_ATRIBUTES.copy() + def feed(self, text): + text = self.unescape(text) + return HTMLParser.feed(self, text) + def _toggle_attribute(self, attribute): if self.text: self.substrings.append(