From: Go MAEDA Date: Mon, 26 Dec 2022 01:36:44 +0000 (+0000) Subject: Ruby 3.2: `Changeset.normalize_comments` raises Encoding::CompatibilityError if the... X-Git-Tag: 5.1.0~322 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f186e614eefbcdb56c79c2dbb37b426799e9efe9;p=redmine.git Ruby 3.2: `Changeset.normalize_comments` raises Encoding::CompatibilityError if the string contains an invalid UTF-8 byte sequence (#38099, #38100). Patch by Go MAEDA. git-svn-id: https://svn.redmine.org/redmine/trunk@22000 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/changeset.rb b/app/models/changeset.rb index b4501b19e..db55c3e3b 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -296,7 +296,7 @@ class Changeset < ActiveRecord::Base class << self # Strips and reencodes a commit log before insertion into the database def normalize_comments(str, encoding) - Changeset.to_utf8(str.to_s.strip, encoding) + Changeset.to_utf8(str.to_s, encoding).strip end def to_utf8(str, encoding)