@@ -103,10 +103,11 module Redmine | |||||
103 | encodings = Setting.repositories_encodings.split(',').collect(&:strip) |
|
103 | encodings = Setting.repositories_encodings.split(',').collect(&:strip) | |
104 | encodings.each do |encoding| |
|
104 | encodings.each do |encoding| | |
105 | if str.respond_to?(:force_encoding) |
|
105 | if str.respond_to?(:force_encoding) | |
106 | str.force_encoding(encoding) |
|
|||
107 | begin |
|
106 | begin | |
108 | return str.encode('UTF-8') |
|
107 | str.force_encoding(encoding) | |
109 | rescue Encoding::InvalidByteSequenceError |
|
108 | utf8 = str.encode('UTF-8') | |
|
109 | return utf8 if utf8.valid_encoding? | |||
|
110 | rescue | |||
110 | # do nothing here and try the next encoding |
|
111 | # do nothing here and try the next encoding | |
111 | end |
|
112 | end | |
112 | else |
|
113 | else |
General Comments 0
You need to be logged in to leave comments.
Login now