Brute force fix for Changeset#committer encoding on 1.9.2
This commit is contained in:
parent
477a5f3702
commit
d2724ef89c
|
@ -74,6 +74,14 @@ class Changeset < ActiveRecord::Base
|
|||
user || committer.to_s.split('<').first
|
||||
end
|
||||
|
||||
# Committer of the Changeset
|
||||
#
|
||||
# Attribute reader for committer that encodes the committer string to
|
||||
# the repository log encoding (e.g. UTF-8)
|
||||
def committer
|
||||
self.class.to_utf8(read_attribute(:committer), repository.repo_log_encoding)
|
||||
end
|
||||
|
||||
def before_create
|
||||
self.committer = self.class.to_utf8(self.committer, repository.repo_log_encoding)
|
||||
self.comments = self.class.normalize_comments(self.comments, repository.repo_log_encoding)
|
||||
|
@ -273,12 +281,6 @@ class Changeset < ActiveRecord::Base
|
|||
end
|
||||
str = txtar
|
||||
end
|
||||
# removes invalid UTF8 sequences
|
||||
begin
|
||||
Iconv.conv('UTF-8//IGNORE', 'UTF-8', str + ' ')[0..-3]
|
||||
rescue Iconv::InvalidEncoding
|
||||
# "UTF-8//IGNORE" is not supported on some OS
|
||||
str
|
||||
end
|
||||
str
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue