Project

General

Profile

Actions

Defect #10590

closed

WikiContent::Version#text return string with #<Encoding:ASCII-8BIT> when uncompressed

Added by Alexander Oryol over 12 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Wiki
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

  • ruby 1.9.3p125
  • postgresql 8.4.11
  • rails 2.3.14
  • redmine trunk

Wiki history compression: none

$ script/console 
Loading development environment (Rails 2.3.14)
/home/asor/.rvm/gems/ruby-1.9.3-p125-fast/gems/activesupport-2.3.14/lib/active_support/inflector.rb:3:in `<top (required)>': iconv will be deprecated in the future, use String#encode instead.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/asor/.rvm/gems/ruby-1.9.3-p125-fast/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.
>> WikiPage.find(:first).content.text.encoding
=> #<Encoding:UTF-8>
>> WikiPage.find(:first).content.versions.first.text.encoding
=> #<Encoding:ASCII-8BIT>

We should always force_encoding to UTF-8, if data stored as binary type.
The patch attached.

When applied:

>> WikiPage.find(:first).content.text.encoding
=> #<Encoding:UTF-8>
>> WikiPage.find(:first).content.versions.first.text.encoding
=> #<Encoding:UTF-8>


Files

force_encoding_always.patch (1.06 KB) force_encoding_always.patch Alexander Oryol, 2012-04-03 10:16
Actions

Also available in: Atom PDF