Commit 95fbb07aa63e8d78f6f2677ac081f344ded47867
1 parent
693f2001
Exists in
master
and in
29 other branches
rails3: replace iconv with transliterate
Showing
1 changed file
with
1 additions
and
5 deletions
Show diff stats
app/helpers/tags_helper.rb
... | ... | @@ -41,15 +41,11 @@ module TagsHelper |
41 | 41 | max = tags.values.max.to_f |
42 | 42 | min = tags.values.min.to_f |
43 | 43 | |
44 | - # Uses iconv to translate utf8 strings to ascii. | |
45 | - # If can't translate a character, ignore it. | |
46 | - require 'iconv' | |
47 | - utf8_to_ascii = Iconv.new("ASCII//TRANSLIT//IGNORE","UTF8") | |
48 | 44 | # Sorts first based on translated strings and then, if they are equal, based on the original form. |
49 | 45 | # This way variant characters falls on the same level as their base characters and don't end up |
50 | 46 | # at the end of the tag list. |
51 | 47 | # Example: AA ÁA AB Z instead of AA AB Z ÁA |
52 | - tags.collect{ |k,v| [utf8_to_ascii.iconv(k).downcase, [k,v]] }.sort.collect { |ascii, t| t }.map do |tag,count| | |
48 | + tags.collect{ |k,v| [ActiveSupport::Inflector.transliterate(k).downcase, [k,v]] }.sort.collect { |ascii, t| t }.map do |tag,count| | |
53 | 49 | if ( max == min ) |
54 | 50 | v = 0.5 |
55 | 51 | else | ... | ... |