From 03288cf9b66bf2a614af6ce7cc4fe496ecf29a5c Mon Sep 17 00:00:00 2001 From: Wilhelm Dewald Date: Tue, 24 Mar 2015 18:21:01 +0100 Subject: [PATCH] strip_tags is breaking special characters. i would use instead sanitize --- lib/meta_tags/text_normalizer.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/meta_tags/text_normalizer.rb b/lib/meta_tags/text_normalizer.rb index 382a465d..cddeb1b0 100644 --- a/lib/meta_tags/text_normalizer.rb +++ b/lib/meta_tags/text_normalizer.rb @@ -7,7 +7,7 @@ module TextNormalizer # @return [Array] 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. @@ -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 Array#join # 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