Project

General

Profile

Defect #10590 ยป force_encoding_always.patch

Alexander Oryol, 2012-04-03 10:16

View differences:

app/models/wiki_content.rb
91 91
    end
92 92

  
93 93
    def text
94
      @text ||= case compression
95
      when 'gzip'
96
        str = Zlib::Inflate.inflate(data)
94
      @text ||= begin
95
        str = case compression
96
              when 'gzip'
97
                Zlib::Inflate.inflate(data)
98
              else
99
                # uncompressed data
100
                data
101
              end
97 102
        str.force_encoding("UTF-8") if str.respond_to?(:force_encoding)
98 103
        str
99
      else
100
        # uncompressed data
101
        data
102 104
      end
103 105
    end
104 106

  
    (1-1/1)