vivekn/redis-simple-cache — pull request #20 by jmtoball (2014-06-16 04:11:33+00:00)
Title: Test and fix unicode-support in key-related functions

Hello,

I recently came across a problem where I was unable to store keys that had accents or umlaut-characters in them, no matter if I provided unicode or utf8-encoded strings.
After some debugging on my side I realized the problem was actually coming from the key handiling in redis-simple-cache itself. So far, keys were just concatenated to the prefix-string. As the keys are converted to unicode in store(), they are encoded using the ascii-codec while being concatenated and as ascii can't handle the accents and umlauts, this fails. To fix this, one merely has to declare the prefix-bits unicode strings.

I wrote a test that should fail if you leave out the changes in rediscache.py and passes with them.

There might be some more places where the same issue might occur, e.g. in __iter__ and the cache_it-decorator, but I can't currently produce a concise testcase for that.