diff --git a/app/helpers/text_helper.rb b/app/helpers/text_helper.rb index fbc6059..39d0162 100644 --- a/app/helpers/text_helper.rb +++ b/app/helpers/text_helper.rb @@ -11,8 +11,8 @@ def truncate_html(text, max_length = 30, ellipsis = "...") return if text.nil? doc = Hpricot(text.to_s) - ellipsis_length = Hpricot(ellipsis).inner_text.chars.length - content_length = doc.inner_text.chars.length + ellipsis_length = Hpricot(ellipsis).inner_text.length + content_length = doc.inner_text.length actual_length = max_length - ellipsis_length content_length > max_length ? doc.truncate(actual_length).inner_html + ellipsis : text.to_s