Skip to content

Commit dfca030

Browse files
committed
Remove deprecated/obsolete Unicode handling code
1 parent 05569af commit dfca030

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

lib/acts-as-taggable-on/tag.rb

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ def validates_name_uniqueness?
2525

2626
def self.named(name)
2727
if ActsAsTaggableOn.strict_case_match
28-
where(["name = #{binary}?", as_8bit_ascii(name)])
28+
where(["name = #{binary}?", name.to_s])
2929
else
30-
where(['LOWER(name) = LOWER(?)', as_8bit_ascii(unicode_downcase(name))])
30+
where(['LOWER(name) = LOWER(?)', name.to_s.downcase])
3131
end
3232
end
3333

@@ -118,27 +118,19 @@ def comparable_name(str)
118118
if ActsAsTaggableOn.strict_case_match
119119
str
120120
else
121-
unicode_downcase(str.to_s)
121+
str.to_s.downcase
122122
end
123123
end
124124

125125
def binary
126126
ActsAsTaggableOn::Utils.using_mysql? ? 'BINARY ' : nil
127127
end
128128

129-
def as_8bit_ascii(string)
130-
string.to_s.mb_chars
131-
end
132-
133-
def unicode_downcase(string)
134-
as_8bit_ascii(string).downcase
135-
end
136-
137129
def sanitize_sql_for_named_any(tag)
138130
if ActsAsTaggableOn.strict_case_match
139-
sanitize_sql(["name = #{binary}?", as_8bit_ascii(tag)])
131+
sanitize_sql(["name = #{binary}?", tag.to_s])
140132
else
141-
sanitize_sql(['LOWER(name) = LOWER(?)', as_8bit_ascii(unicode_downcase(tag))])
133+
sanitize_sql(['LOWER(name) = LOWER(?)', tag.to_s.downcase])
142134
end
143135
end
144136
end

lib/acts-as-taggable-on/tag_list.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def clean!
8282
reject!(&:blank?)
8383
map!(&:to_s)
8484
map!(&:strip)
85-
map! { |tag| tag.mb_chars.downcase.to_s } if ActsAsTaggableOn.force_lowercase
85+
map! { |tag| tag.to_s.downcase } if ActsAsTaggableOn.force_lowercase
8686
map!(&:parameterize) if ActsAsTaggableOn.force_parameterize
8787

8888
ActsAsTaggableOn.strict_case_match ? uniq! : uniq!(&:downcase)

0 commit comments

Comments
 (0)