Merge pull request #124 from mbreit/bugfix/707-wiki-diff-encoding-error-ruby19
[#707] Fix encoding error on wiki diffs on Ruby 1.9
This commit is contained in:
commit
8b7ee93f90
|
@ -104,7 +104,12 @@ class WikiContent < ActiveRecord::Base
|
|||
def text
|
||||
@text ||= case changes["compression"]
|
||||
when "gzip"
|
||||
Zlib::Inflate.inflate(changes["data"])
|
||||
data = Zlib::Inflate.inflate(changes["data"])
|
||||
if data.respond_to? :force_encoding
|
||||
data.force_encoding("UTF-8")
|
||||
else
|
||||
data
|
||||
end
|
||||
else
|
||||
# uncompressed data
|
||||
changes["data"]
|
||||
|
|
Loading…
Reference in New Issue