So, I am slamming my head into my desk right now. I am trying to take a string containing unicode character codes and convert it to a python unicode string. I thought it would be simple, but I am having major issues. Any help would be greatly appreciated. This is what I am confused about.
Starting with this:
test = "\u2022" I want to convert it to a unicode string which should look like
u'\u2022' But when I try to convert
test.encode("utf-8") I gives me back
u'\\u2022' which when printed just shows "\u2022" which is not helpful at all!
Check this out:
>>> test = "\u2022" >>> test.decode("utf-8") u'\\u2022' >>> test.encode("utf-8") u'\\u2022' >>> print test.decode("utf-8") \u2022 >>> print test.encode("utf-8") \u2022
So, I must be missing something, I am retrieving the original string externally so I cannot make it unicode from the start, I need to be able to convert it after the fact. I feel like I have tried everything, it would be great if there was a simple fix.
Thanks very much!