Skip to content

Unicode error #5

@az0

Description

@az0

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions