This project is archived and is in readonly mode.
MemCacheStore can't deal with Umlauts and special characters
-
Pan Thomakos
I ran into this same bug with UTF-8 special characters.
The issue is in the ActiveSupport::Cache::MemCacheStore#escape_key function where the key is checked against an ASCII-8BIT regular expression for special characters. I've created a patch to solve this issue by forcing the encoding to comply with the regular expression's encoding in Ruby 1.9. The tests I added also check that any strings formatted any in any other encoding also work. I checked that tests pass for Ruby 1.8.7 and Ruby 1.9.2.
Please try the patch and let me know if everything works.
-
Matt Jones
- Tag changed from memcachestore to memcachestore, patch
- Importance changed from to Low
-
Pan Thomakos
I've update the patch.
After making the original change, I realized that the escape_key function forces the initial string into a new encoding. This means that the escape_key function changes the original encoding of the argument, which can cause problems further down the line in an application.
To fix this I have added another test that checks if the encoding of the original string changes.
Please use this updated patch that dups the argument to avoid this encoding change issue.
-
Pan Thomakos
I created a pull request for this bug as well.
-
Mike Perham
I had the same issue in Dalli and fixed it in a similar manner:
-
Pan Thomakos
That's very similar to what I do, but I use the encoding of the ESCAPE_KEY_CHARS, in case it ever changes. If you get a chance, please take a look at the patch or pull request and leave your comments if it works.
