diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 62ce7a22..1727b2cb 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -96,7 +96,7 @@ require 'stringsupport'
# Performs HTML escaping on text, but keeps linefeeds intact (by replacing them with
)
def escape_preserving_linefeeds(text)
- h(text).gsub(/\n/, '
')
+ h(text).gsub(/\n/, '
').as_utf8
end
def format_date(date, include_time = true)
diff --git a/app/models/page.rb b/app/models/page.rb
index 28ed497a..2ce6feb3 100644
--- a/app/models/page.rb
+++ b/app/models/page.rb
@@ -108,7 +108,7 @@ class Page < ActiveRecord::Base
end
def to_param
- name
+ name.as_utf8
end
private
diff --git a/app/models/wiki_reference.rb b/app/models/wiki_reference.rb
index cbc7bcd8..82ef95dc 100644
--- a/app/models/wiki_reference.rb
+++ b/app/models/wiki_reference.rb
@@ -78,7 +78,7 @@ class WikiReference < ActiveRecord::Base
"AND wiki_references.link_type = '#{REDIRECTED_PAGE}' " +
"AND pages.web_id = '#{web.id}'"
row = connection.select_one(sanitize_sql([query, page_name]))
- row['name'] if row
+ row['name'].as_utf8 if row
end
def self.pages_in_category(web, category)
@@ -88,7 +88,7 @@ class WikiReference < ActiveRecord::Base
"WHERE wiki_references.referenced_name = ? " +
"AND wiki_references.link_type = '#{CATEGORY}' " +
"AND pages.web_id = '#{web.id}'"
- names = connection.select_all(sanitize_sql([query, category])).map { |row| row['name'] }
+ names = connection.select_all(sanitize_sql([query, category])).map { |row| row['name'].as_utf8 }
end
def self.list_categories(web)