Ruby 1.9: fix encoding error on wiki diffs (#4050)
WikiDiff#to_html returns a string with ASCII encoding if the WikiJournal content has been Zlib compressed because Zlib::Inflate.inflate returns strings with ASCII encoding. Forcing the encoding to be UTF8 fixes this bug. Contributed by Moritz Breit. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7927 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
7ed7d8984d
commit
1dab1cd5cc
|
@ -88,7 +88,9 @@ class WikiContent < ActiveRecord::Base
|
|||
def text
|
||||
@text ||= case compression
|
||||
when 'gzip'
|
||||
Zlib::Inflate.inflate(data)
|
||||
str = Zlib::Inflate.inflate(data)
|
||||
str.force_encoding("UTF-8") if str.respond_to?(:force_encoding)
|
||||
str
|
||||
else
|
||||
# uncompressed data
|
||||
data
|
||||
|
|
Loading…
Reference in New Issue