summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-09-17 15:48:58 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-09-17 15:48:58 +0000
commit5e8af450c852e3439109d36ae9b6b2dd6f5eae6f (patch)
tree9d7928d15a5218620d7b4df4180ca875003dd21a /lib
parentb267f7e08d6ca6bc57c811632d6e2c6bddf8dc65 (diff)
downloadredmine-5e8af450c852e3439109d36ae9b6b2dd6f5eae6f.tar.gz
redmine-5e8af450c852e3439109d36ae9b6b2dd6f5eae6f.zip
add empty line after guard clause to lib/redmine/codeset_util.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@20045 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/codeset_util.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/redmine/codeset_util.rb b/lib/redmine/codeset_util.rb
index 53728928c..8261e572b 100644
--- a/lib/redmine/codeset_util.rb
+++ b/lib/redmine/codeset_util.rb
@@ -5,6 +5,7 @@ module Redmine
def self.replace_invalid_utf8(str)
return nil if str.nil?
+
str = str.dup
str.force_encoding('UTF-8')
if ! str.valid_encoding?
@@ -16,6 +17,7 @@ module Redmine
def self.to_utf8(str, encoding)
return if str.nil?
+
str = str.b
if str.empty?
str.force_encoding("UTF-8")
@@ -34,15 +36,18 @@ module Redmine
def self.to_utf8_by_setting(str)
return if str.nil?
+
str = str.dup
self.to_utf8_by_setting_internal(str).force_encoding('UTF-8')
end
def self.to_utf8_by_setting_internal(str)
return if str.nil?
+
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')
encodings = Setting.repositories_encodings.split(',').collect(&:strip)
encodings.each do |encoding|
@@ -59,6 +64,7 @@ module Redmine
def self.from_utf8(str, encoding)
return if str.nil?
+
str = str.dup
str ||= ''
str.force_encoding('UTF-8')