summaryrefslogtreecommitdiffstats
path: root/app/models/wiki_content.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-11-25 23:15:55 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-11-25 23:15:55 +0000
commit1dab1cd5cc9d46724b8d722d994737806ee22bb9 (patch)
treee6891a7a92a1fac9fc5bd27a4563b0a4180a2e6d /app/models/wiki_content.rb
parent7ed7d8984ddc30a8db5b55d7fdb5f0cdda6c2efb (diff)
downloadredmine-1dab1cd5cc9d46724b8d722d994737806ee22bb9.tar.gz
redmine-1dab1cd5cc9d46724b8d722d994737806ee22bb9.zip
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
Diffstat (limited to 'app/models/wiki_content.rb')
-rw-r--r--app/models/wiki_content.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/wiki_content.rb b/app/models/wiki_content.rb
index 45640dc71..b1fe60fec 100644
--- a/app/models/wiki_content.rb
+++ b/app/models/wiki_content.rb
@@ -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