diff --git a/lib/common/collections/wp_items/detectable.rb b/lib/common/collections/wp_items/detectable.rb index e10a1990..c84fd8b9 100644 --- a/lib/common/collections/wp_items/detectable.rb +++ b/lib/common/collections/wp_items/detectable.rb @@ -95,6 +95,10 @@ class WpItems < Array code = tag.text.to_s next if code.empty? + if ! code.valid_encoding? + code = code.encode('UTF-16be', :invalid => :replace, :replace => '?').encode('UTF-8') + end + code.scan(code_pattern(wp_target)).flatten.uniq.each do |item_name| names << item_name end