Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strip_tags is breaking special characters. i would use sanitize instead #85

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/meta_tags/text_normalizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module TextNormalizer
# @return [Array<String>] array of title parts with tags removed.
#
def self.normalize_title(title)
Array(title).flatten.map(&method(:strip_tags))
Array(title).flatten.map(&method(:sanitize))
end

# Normalize description value.
Expand Down Expand Up @@ -48,6 +48,13 @@ def self.strip_tags(string)
helpers.strip_tags(string)
end

#
# strip_tags does encode special characters, sanitize not
#
def self.sanitize(string)
helpers.sanitize(string)
end

# This method returns a html safe string similar to what <tt>Array#join</tt>
# would return. All items in the array, including the supplied separator, are
# html escaped unless they are html safe, and the returned string is marked
Expand Down