From 943bfc39b3bba657d851c8961bbb269c8067965f Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Tue, 14 Jun 2016 03:30:17 +0200 Subject: [PATCH] fix for #957 --- lib/common/collections/wp_items/detectable.rb | 4 ++++ 1 file changed, 4 insertions(+) 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