[Answered ]-UnicodeEncodeError at /notifications/ajax/ 'ascii' codec can't encode character: ordinal not in range(128)

2👍

Using str on the Korean character is going to fail in python 2 – you should be using .encode() for this. So changing str(note.get_link) to note.get_link.encode('utf-8') should get things working.

Check out the unicode how to in the docs

>>> x = u'\ubbbb'
>>> x
u'\ubbbb'
>>> type(x)
<type 'unicode'>
>>> str(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\ubbbb' in position 0: ordinal not in range(128)
>>> x.encode('utf-8')
'\xeb\xae\xbb'

Leave a comment