New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
padrino-cache ArgumentError: invalid byte sequence in UTF-8 #821
Comments
Try setting in boot.rb Encoding.default_internal = nil
Encoding.default_external = 'ASCII-8BIT' But why not the Marshl.dump is UTF-8 always? |
👍 I'm having trouble with this as well. Is there anything I can do right now to fix my application? |
Are there performance concerns around changing
to
Am I missing something? |
Another thing worth mentioning: at least for me, this seemed to be specifically related to padrino-cache's use of marshalling. Since I was just storing JSON data, I didn't need object serialization. I used Redis directly and am not experiencing this issue. |
Shall we move this off of 0.11.0? I'd like to release soon. Please advise if want to aim to do this before release @DAddYE @dariocravero |
@DAddYE would know better... |
@DAddYE Is this still an issue in edge? |
@nesquena yesse and also on ruby 2.0 |
Now different than before the we store data as plain text, otherwise we bundle also the marshal serializer or you can simply provide yours. Example: Padrino.cache = Padrino::Cache::File.new(...) Padrino.cache.parser # => Padrino::Cache::Parser:Plain Padrino.cache.parser = :marshal Or you can write your own: require 'oj' module PadrinoJSON def self.encode(code) Oj.dump(code) end def self.decode(code) Oj.load(code) end end Finally you can load your strategy: Padrino.cache.parser = PadrinoJSON Or if you prefer do something on the fight you can: Padrino.cache.parser = Module.new do def self.encode end def self.decode end end //cc @padrino/core-members
Sorry for spam 🙉 |
and @dariocravero and @padrino/core-members that had work on cache 👯 |
Closed in favor of #1128 |
Now different than before the we store data as plain text, otherwise we bundle also the marshal serializer or you can simply provide yours. Example: Padrino.cache = Padrino::Cache::File.new(...) Padrino.cache.parser # => Padrino::Cache::Parser:Plain Padrino.cache.parser = :marshal Or you can write your own: require 'oj' module PadrinoJSON def self.encode(code) Oj.dump(code) end def self.decode(code) Oj.load(code) end end Finally you can load your strategy: Padrino.cache.parser = PadrinoJSON Or if you prefer do something on the fight you can: Padrino.cache.parser = Module.new do def self.encode end def self.decode end end //cc @padrino/core-members
* upstream/master: Reflect slim changes on tests Switch to slim as default engine Setup correctly all tasks Use a consistent name also for minirecord. Added bundler/setup to the generated Rakefile. [cache] Cleanup old code, add comments and fix test Added Cache Parser Strategy. Fix padrino#821 [WIP] Added a cache parser for padrino#821 with a default now to Plain. [helpers] Fix all capture_concat templates to be equal in tests
I'm trying to get a Redis cache working with Padrino 0.10.6 and Ruby 1.9.3-p125 on OS X 10.7.3.
I've been getting
ArgumentError: invalid byte sequence in UTF-8
errors when the cache is read.Here is a stripped-down gist to demonstrate the error: https://gist.github.com/2279844
In the above gist, there are two examples of UTF-8 strings (differing by a single character) being assigned to the
:response_buffer
key in the hash that is passed toMarshal.dump
.When the second example is retrieved from Redis, it contains a non-UTF-8 character that then causes a regexp in ActiveSupport to choke on the input.
I don't even know if this is a Padrino bug, so I'd welcome any pointers.
The text was updated successfully, but these errors were encountered: