summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-12 22:34:00 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-12 22:34:00 +0000
commit45f870cb53ea701a564e1db7b14733397548f628 (patch)
tree6bd89eac783715680b5e8e6d70003f9d6508ae9a /lib
parentff53a9cfe18d006c4bcc7b82755f81821c0b6476 (diff)
downloadredmine-45f870cb53ea701a564e1db7b14733397548f628.tar.gz
redmine-45f870cb53ea701a564e1db7b14733397548f628.zip
Encoding::InvalidByteSequenceError may be raised even if encoding is valid (#12787).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11178 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/codeset_util.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/redmine/codeset_util.rb b/lib/redmine/codeset_util.rb
index 41ea85153..33fe88bd7 100644
--- a/lib/redmine/codeset_util.rb
+++ b/lib/redmine/codeset_util.rb
@@ -104,8 +104,10 @@ module Redmine
encodings.each do |encoding|
if str.respond_to?(:force_encoding)
str.force_encoding(encoding)
- if str.valid_encoding?
+ begin
return str.encode('UTF-8')
+ rescue Encoding::InvalidByteSequenceError
+ # do nothing here and try the next encoding
end
else
begin