FIX: force encoding for title field
Job exception: incompatible character encodings: UTF-8 and ASCII-8BIT -- This exception rise up for correct(!) UTF-8 cyrillic (in my case, but non-latin overall, I suppose) in title field during RSS polling (feed polling url) and breaks topics creation. So, just force_encoding() makes it work.
This commit is contained in:
parent
6391dc7f28
commit
9cf68c99b7
|
@ -41,7 +41,7 @@ class SearchObserver < ActiveRecord::Observer
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.update_posts_index(post_id, cooked, title, category)
|
def self.update_posts_index(post_id, cooked, title, category)
|
||||||
search_data = scrub_html_for_search(cooked) << " " << title
|
search_data = scrub_html_for_search(cooked) << " " << title.force_encoding('UTF-8')
|
||||||
search_data << " " << category if category
|
search_data << " " << category if category
|
||||||
update_index('post', post_id, search_data)
|
update_index('post', post_id, search_data)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue