Skip to content
This repository was archived by the owner on Jul 4, 2022. It is now read-only.

Non-Ascii Cache Key #7

Open
minrivertea opened this issue Nov 2, 2013 · 1 comment
Open

Non-Ascii Cache Key #7

minrivertea opened this issue Nov 2, 2013 · 1 comment

Comments

@minrivertea
Copy link

I have a URL like this that needs to be cached "/search/快递/" - i.e. Chinese characters in the URL. It causes a UnicodeEncodeError here:

https://github.com/torchbox/django-nginx-memcache/blob/master/nginx_memcache/cache.py#L80-L94

It seems hashlib.md5 can't handle the non-ascii (Chinese) characters when it tries to derive a cache key from the incoming URL. Would it be as simple as adding ".encode('utf-8')" to the request_path variable?

@stevejalim
Copy link

Hi Chris

Thanks for the report. I'm afraid I don't have time to try this now, but what you're suggesting makes sense and sounds worth pursuing.

Are you able to try it out? If you are, and it works, please do send me a patch or a pull request that fixes (specificially) this issue and I'll merge it.

Cheers

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants