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
|
user || committer.to_s.split('<').first
|
||||||
end
|
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
|
def before_create
|
||||||
self.committer = self.class.to_utf8(self.committer, repository.repo_log_encoding)
|
self.committer = self.class.to_utf8(self.committer, repository.repo_log_encoding)
|
||||||
self.comments = self.class.normalize_comments(self.comments, 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
|
end
|
||||||
str = txtar
|
str = txtar
|
||||||
end
|
end
|
||||||
# removes invalid UTF8 sequences
|
str
|
||||||
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
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user