Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: string index out of range #201

Closed
ataylor32 opened this issue May 15, 2018 · 0 comments
Closed

IndexError: string index out of range #201

ataylor32 opened this issue May 15, 2018 · 0 comments

Comments

@ataylor32
Copy link

I got some unusual HTML from an HTML email and it caused html2text to raise an exception.

html2text 2018.1.9
Python 3.5.2

>>> import html2text
>>> test = '<i></i>‪&lrm;'
>>> html2text.html2text(test)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/var/www/example.com/venv-example/lib/python3.5/site-packages/html2text/__init__.py", line 937, in html2text
    return h.handle(html)
  File "/var/www/example.com/venv-example/lib/python3.5/site-packages/html2text/__init__.py", line 149, in handle
    self.feed(data)
  File "/var/www/example.com/venv-example/lib/python3.5/site-packages/html2text/__init__.py", line 146, in feed
    HTMLParser.HTMLParser.feed(self, data)
  File "/usr/lib/python3.5/html/parser.py", line 111, in feed
    self.goahead(0)
  File "/usr/lib/python3.5/html/parser.py", line 219, in goahead
    self.handle_entityref(name)
  File "/var/www/example.com/venv-example/lib/python3.5/site-packages/html2text/__init__.py", line 189, in handle_entityref
    self.handle_data(self.entityref(c), True)
  File "/var/www/example.com/venv-example/lib/python3.5/site-packages/html2text/__init__.py", line 802, in handle_data
    and re.match(r'[^\s.!?]', data[0])
IndexError: string index out of range
Unit03 added a commit to Unit03/html2text that referenced this issue Jul 15, 2018
- mid-text within stressed tags
- right after stressed tags

Fixes Alir3z4#201.
Unit03 added a commit to Unit03/html2text that referenced this issue Aug 2, 2018
- mid-text within stressed tags
- right after stressed tags

Fixes Alir3z4#201.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants