idangazit/oauthlib — pull request #31 by dstufft (2012-05-01 13:35:59+00:00)
Title: Simplify the quote and unquote function

After digging into the quote/unquote function I couldn't determine an actual reason for all the advanced logic. It appears that simply encoding/decoding achieves the desired result.

All the tests pass and such. Would probably be good to check with @dgouldin to see if there was a reason for the original method over this way. If there are edge cases where this way doesn't work it'd likely be good to set them down in tests. Additionally there was a test that the quote function returns unicode, which this PR adds, but i question wether it should return unicode since unicode characters are not valid in a URI anyways.

If this way does work it's likely there are other functions in here that could use a similar technique.

If this way doesn't work, the root cause of the problem was that keys to the dictionary are bytestrings "\xf8" instead of unicode characters u"\xf8" and "\xf8" != u"\xf8" so a KeyError occurs.