Feature #26423 ยป rchardet.patch
| redmine/lib/redmine/codeset_util.rb.n 2017-07-13 15:24:10.791827525 +0700 | ||
|---|---|---|
|
require 'rchardet'
|
||
|
module Redmine
|
||
|
module CodesetUtil
|
||
| ... | ... | |
|
return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
|
||
|
str.force_encoding('UTF-8')
|
||
|
encodings = Setting.repositories_encodings.split(',').collect(&:strip)
|
||
|
encodings.unshift(CharDet.detect(str)['encoding'])
|
||
|
encodings.each do |encoding|
|
||
|
begin
|
||
|
str.force_encoding(encoding)
|
||