Python: Creating a Unicode string
python, unicode
Solution
I think it depends if your title has a unicode characters or not.
I would try adding `art.title.encode("utf-8")` or `art.title.decode("utf-8")` and see how it works
Problem
I have a problem in Python with Unicode. I need plot a graph with Unicode annotations in it. According to the tutorial I should just create my string in Unicode. I do it like this: ``` annotation = u"%s has %s rev"%(art.title, len(art.revisions)) ``` It is `art.title` that has Unicode characters in it. Sometimes that code works, sometimes it gives me the error below: ``` UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 19: ordinal not in range(128) ``` How can I fix it? EDIT: I have error exactly after "annotation" line: ``` File "script.py", line 195, in test_trie annotation = u"%s has %s rev"%(art.title, len(art.revisions)) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 19: ordinal not in range(128) ```