readability icon indicating copy to clipboard operation
readability copied to clipboard

Unicode error

Open az0 opened this issue 11 years ago • 0 comments

Shouldn't this work?

>>> Readability(u'This does not work\u2762').SMOGIndex()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "readability\readability.py", line 16, in __init__
    self.analyze_text(text)
  File "readability\readability.py", line 20, in analyze_text
    char_count = get_char_count(words)
  File "readability\utils.py", line 17, in get_char_count
    characters += len(word.decode("utf-8"))
  File "c:\Python27\lib\encodings\utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2762' in position 4: ordinal not in range(128)

P.S., thank you for the nice code.

az0 avatar Jan 09 '15 22:01 az0