summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-01-13 00:43:24 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-01-13 00:43:24 +0000
commit58dfbde1ea7cc6f8963350b1702b8d53e68d072e (patch)
tree70148aee649442b7dfc659c7f6a56c11abb3f451 /lib
parent45f870cb53ea701a564e1db7b14733397548f628 (diff)
downloadredmine-58dfbde1ea7cc6f8963350b1702b8d53e68d072e.tar.gz
redmine-58dfbde1ea7cc6f8963350b1702b8d53e68d072e.zip
fix test failures (#12787)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11179 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/codeset_util.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/redmine/codeset_util.rb b/lib/redmine/codeset_util.rb
index 33fe88bd7..45a5c3524 100644
--- a/lib/redmine/codeset_util.rb
+++ b/lib/redmine/codeset_util.rb
@@ -103,10 +103,11 @@ module Redmine
encodings = Setting.repositories_encodings.split(',').collect(&:strip)
encodings.each do |encoding|
if str.respond_to?(:force_encoding)
- str.force_encoding(encoding)
begin
- return str.encode('UTF-8')
- rescue Encoding::InvalidByteSequenceError
+ str.force_encoding(encoding)
+ utf8 = str.encode('UTF-8')
+ return utf8 if utf8.valid_encoding?
+ rescue
# do nothing here and try the next encoding
end
else