summaryrefslogtreecommitdiffstats
path: root/app/helpers/attachments_helper.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-11-20 11:46:52 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-11-20 11:46:52 +0000
commit77710ece26d8503e365a5211b010eb9be81c1c99 (patch)
tree2dee610d4510b49b48a7d865ed62a81461a4b1b9 /app/helpers/attachments_helper.rb
parent85db02d486d658c1d0e83f915a39fac5a6ed6b27 (diff)
downloadredmine-77710ece26d8503e365a5211b010eb9be81c1c99.tar.gz
redmine-77710ece26d8503e365a5211b010eb9be81c1c99.zip
attachment: use repositories setting to convert contents character encoding (#2371)
This commit results replacing invalid encoding instead to stripping. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7866 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/attachments_helper.rb')
-rw-r--r--app/helpers/attachments_helper.rb14
1 files changed, 1 insertions, 13 deletions
diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb
index 640a40c21..3d98b95d3 100644
--- a/app/helpers/attachments_helper.rb
+++ b/app/helpers/attachments_helper.rb
@@ -29,19 +29,7 @@ module AttachmentsHelper
end
def to_utf8(str)
- if str.respond_to?(:force_encoding)
- str.force_encoding('UTF-8')
- return str if str.valid_encoding?
- else
- return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
- end
-
- 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
+ Redmine::CodesetUtil.to_utf8_by_setting(str)
end
def render_api_attachment(attachment, api)