summaryrefslogtreecommitdiffstats
path: root/lib/redmine/codeset_util.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-03-20 01:36:44 +0000
committerGo MAEDA <maeda@farend.jp>2019-03-20 01:36:44 +0000
commit606e75d12d30644d15732f8fbbb61041c2abde3b (patch)
tree7cb4fd47c97bfa77f9212dd36bea883d25def70a /lib/redmine/codeset_util.rb
parent26509e7f4c6dae94baf291b95d46eb6ec8ebca0b (diff)
downloadredmine-606e75d12d30644d15732f8fbbb61041c2abde3b.tar.gz
redmine-606e75d12d30644d15732f8fbbb61041c2abde3b.zip
Use #b shortcut instead of #force_encoding (#31059).
Patch by Pavel Rosický. git-svn-id: http://svn.redmine.org/redmine/trunk@17992 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/codeset_util.rb')
-rw-r--r--lib/redmine/codeset_util.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/redmine/codeset_util.rb b/lib/redmine/codeset_util.rb
index 23e1018a5..d74d5de39 100644
--- a/lib/redmine/codeset_util.rb
+++ b/lib/redmine/codeset_util.rb
@@ -16,8 +16,7 @@ module Redmine
def self.to_utf8(str, encoding)
return if str.nil?
- str = str.dup
- str.force_encoding("ASCII-8BIT")
+ str = str.b
if str.empty?
str.force_encoding("UTF-8")
return str
@@ -41,8 +40,7 @@ module Redmine
def self.to_utf8_by_setting_internal(str)
return if str.nil?
- str = str.dup
- str.force_encoding('ASCII-8BIT')
+ str = str.b
return str if str.empty?
return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
str.force_encoding('UTF-8')