Feature #4577 ยป attachments_helper.rb.patch
| /mnt/base02_data/attachments_helper.rb 2010-03-25 15:57:53.764533400 +0900 | ||
|---|---|---|
|
render :partial => 'attachments/links', :locals => {:attachments => container.attachments, :options => options}
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def to_utf8(str)
|
||
|
return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
|
||
|
@encodings ||= Setting.repositories_encodings.split(',').collect(&:strip)
|
||
|
@encodings.each do |encoding|
|
||
|
begin
|
||
|
return Iconv.conv('UTF-8', encoding, str)
|
||
|
rescue Iconv::Failure
|
||
|
# do nothing here and try the next encoding
|
||
|
end
|
||
|
end
|
||
|
str
|
||
|
end
|
||
|
end
|
||