w3c

How to unquote a urlencoded unicode string in python?

How to unquote a urlencoded unicode string in python? Question: I have a unicode string like “Tanım” which is encoded as “Tan%u0131m” somehow. How can i convert this encoded string back to original unicode. Apparently urllib.unquote does not support unicode. Asked By: hamdiakoguz || Source Answers: def unquote(text): def unicode_unquoter(match): return unichr(int(match.group(1),16)) return re.sub(r’%u([0-9a-fA-F]{4})’,unicode_unquoter,text) Answered …

Total answers: 5