From f1cae4f7af77a21af778c376fe01f709d89c2b70 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 6 Apr 2012 07:21:51 +0000 Subject: [PATCH] WikiContent::Version#text may return ascii-8bit encoded string (#10590). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9329 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/wiki_content.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/models/wiki_content.rb b/app/models/wiki_content.rb index 1bbdf09cb..1787a7898 100644 --- a/app/models/wiki_content.rb +++ b/app/models/wiki_content.rb @@ -91,14 +91,16 @@ class WikiContent < ActiveRecord::Base end def text - @text ||= case compression - when 'gzip' - str = Zlib::Inflate.inflate(data) + @text ||= begin + str = case compression + when 'gzip' + Zlib::Inflate.inflate(data) + else + # uncompressed data + data + end str.force_encoding("UTF-8") if str.respond_to?(:force_encoding) str - else - # uncompressed data - data end end -- 2.39.5