Commit e33fa43bdc03ac03ee74807075c028e0991aa36a

Authored by Antonio Terceiro
1 parent 0c0b98b1

ruby1.9: fix to_slug with with non-letter chracters

In Ruby 1.9, \w represents only [a-zA-Z0-9_]. To also catch non-letter
characters (such as Japanese characters), we need the [[:word:]]
character class, which includes Unicodes categories Letter, Mark,
Number, and Connector_Punctuation.

Reference: http://www.ruby-doc.org/core-1.9.3/Regexp.html
Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
lib/noosfero/core_ext/string.rb
... ... @@ -79,7 +79,7 @@ class String
79 79 end
80 80  
81 81 def to_slug
82   - transliterate.downcase.gsub(/[^\w~\s:;+=_."'`-]/, '').gsub(/[\s:;+=_"'`-]+/, '-').gsub(/-$/, '').gsub(/^-/, '').to_s
  82 + transliterate.downcase.gsub(/[^[[:word:]]~\s:;+=_."'`-]/, '').gsub(/[\s:;+=_"'`-]+/, '-').gsub(/-$/, '').gsub(/^-/, '').to_s
83 83 end
84 84  
85 85 def fix_i18n
... ...