calebbrown/oauthlib — pull request #1 by calebbrown (2012-04-19 04:09:08+00:00)
Title: Better handle unicode in OAuth1's parameter parsing.

### Problem

The problem I was having was that `oauth1.rfc5849.signature.collect_parameters()` was not properly supporting headers that were in unicode.

This problem doesn't expose itself unless you pass through parameters that will change when escaped/unescaped, e.g URLs.

The problem can be seen in `Client.sign()`. What happens is `oauth1.rfc5849.parameters.prepare_headers()` is called (via `Client._contribute_parameters()`), builds *and* escapes the headers and returns a unicode encoded header string.

This is then passed to `signature.collect_parameters()` (via `Client.get_oauth_signature()`) which fails to unescape the headers because they're in unicode.

The base string is then built from these, leading to an incorrect signature being generated.

### Solution

My implementation solves the problem by allowing both unicode and str types to be unescaped in `signature.collect_parameters()`.