From 5939195955a230b72cec3676a32a43b826f4abf5 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Fri, 18 Jan 2019 13:40:02 -0600 Subject: [PATCH] Fix iconv bug with apostrophes --- lib/Ebook.php | 3 ++- lib/Formatter.php | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Ebook.php b/lib/Ebook.php index 0c54c098..711a2fb5 100644 --- a/lib/Ebook.php +++ b/lib/Ebook.php @@ -148,7 +148,7 @@ class Ebook{ $this->Timestamp = new \DateTime((string)$xml->xpath('/package/metadata/dc:date')[0]); // Get SE tags - foreach($xml->xpath('/package/metadata/meta[@property="meta-auth"]') ?: [] as $tag){ + foreach($xml->xpath('/package/metadata/meta[@property="se:subject"]') ?: [] as $tag){ $this->Tags[] = (string)$tag; } @@ -335,6 +335,7 @@ class Ebook{ } // Remove diacritics and non-alphanumeric characters + $searchString = str_replace(['‘,', '’'], '', $searchString); $searchString = trim(preg_replace('|[^a-zA-Z0-9 ]|ius', ' ', iconv('UTF-8', 'ASCII//TRANSLIT', $searchString) ?: '') ?? ''); $query = trim(preg_replace('|[^a-zA-Z0-9 ]|ius', ' ', iconv('UTF-8', 'ASCII//TRANSLIT', $query) ?: '') ?? ''); diff --git a/lib/Formatter.php b/lib/Formatter.php index 541e328e..870a37a5 100644 --- a/lib/Formatter.php +++ b/lib/Formatter.php @@ -1,15 +1,16 @@