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