How can I encode and decode percent-encoded (URL encoded) strings in Python?
问题 I wrote a simple application which downloads articles from wiki pages. When I search, for example for a firstname Lech , my code returns strings like Lech_Kaczy%C5%84ski or Lech_Pozna%C5%84 instead of Lech_Kaczyński and Lech_Poznań . How can I decode those characters to ordinary polish letters? I tried to use: urllib.unquote(text) but then got Lech_Kaczy\xc5\x84ski , Lech_Pozna\xc5\x84 instead of Lech_Kaczyński and Lech_Poznań . I have in my code: # -*- coding: utf-8 -*- import sys reload(sys