Project

General

Profile

Feature #26423 ยป rchardet.patch

Dmitri Zhabinski, 2017-07-13 11:05

View differences:

redmine/lib/redmine/codeset_util.rb.n 2017-07-13 15:24:10.791827525 +0700
1
require 'rchardet'
1 2

  
2 3
module Redmine
3 4
  module CodesetUtil
......
46 47
      return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
47 48
      str.force_encoding('UTF-8')
48 49
      encodings = Setting.repositories_encodings.split(',').collect(&:strip)
50
      encodings.unshift(CharDet.detect(str)['encoding'])
49 51
      encodings.each do |encoding|
50 52
        begin
51 53
          str.force_encoding(encoding)
    (1-1/1)