Python 2.7: How to convert unicode escapes in a string into actual utf-8 characters
I use python 2.7 and I'm receiving a string from a server (not in unicode!). Inside that string I find text with unicode escape sequences. For example like this: <a href = "http://www.mypage.com/\u0441andmoretext">\u00b2<\a> How do I convert those \uxxxx - back to utf-8? The answers I found were either dealing with &# or required eval() which is too slow for my purposes. I need a universal solution for any text containing such sequenes. Edit: <\a> is a typo but I want a tolerance against such typos as well. There should only be reaction to \u The example text is meant in proper python syntax