kennethreitz/requests — pull request #911 by rrjamie (2012-10-26 22:12:18+00:00)
Title: Fix IRI encoding issue

We ran in to this issue where IRIs convert to URIs (through Django's `iri_to_uri`) would blow up in requests.

The issues seems to be when IRIs are converted to URIs they are percent-quote encoded, and when requests processes it with IDNA, it blows up because the URL components exceed 64 characters (since now it's three characters per actual character at least). However, they are valid URLs because they may encode to fewer than 64 characters in IDNA.

The solution is to reverse the percent-quote encoding, and then re-encode with IDNA.