converter_not_found.patch

Karel Pičman, 2020-09-14 13:10

Download (811 Bytes)

View differences:

lib/redmine/codeset_util.rb (working copy)
23 23
      end
24 24
      enc = encoding.blank? ? "UTF-8" : encoding
25 25
      if enc.casecmp("UTF-8") != 0
26
        str.force_encoding(enc)
27
        str = str.encode("UTF-8", :invalid => :replace,
26
        begin
27
          str.force_encoding(enc)
28
          str = str.encode("UTF-8", :invalid => :replace,
28 29
              :undef => :replace, :replace => '?')
30
        rescue Encoding::ConverterNotFoundError
31
          Rails.logger.warn ">>> ConverterNotFoundError (#{enc} to UTF-8)"
32
          str = replace_invalid_utf8(str)
33
        end
29 34
      else
30 35
        str = replace_invalid_utf8(str)
31 36
      end