grape-rails-cache icon indicating copy to clipboard operation
grape-rails-cache copied to clipboard

Force encoding as ascii-8bit before storing in rails cache

Open misdoro opened this issue 6 years ago • 1 comments

When raw: true is set in Rails cache options, Rails expects a binary string as an input. No conversion is performed before sending the block result to the cache storage back-end.

When using the Redis/redis_cache_store as Rails.cache store, caching breaks if the json string to be cached contains non-ascii characters, like {"name":"Obélix"} for example.

misdoro avatar Nov 06 '19 18:11 misdoro

Another option could be to remove the raw: true parameter completely.

misdoro avatar Nov 06 '19 18:11 misdoro