From d90e1e1c0b23bf3f579d7526022ff5d77cb43462 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 22 Oct 2023 17:46:25 +0000 Subject: [PATCH] Check for pixiv.net specifically, fuck this. --- src/Lookup/WebLookup.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Lookup/WebLookup.php b/src/Lookup/WebLookup.php index a6fe541..0bb60aa 100644 --- a/src/Lookup/WebLookup.php +++ b/src/Lookup/WebLookup.php @@ -125,10 +125,12 @@ final class WebLookup implements \Uiharu\ILookup { self::reqClose($req); $charSet = $mediaType->getCharset(); - $charSetWrangle = function(string $input) use ($charSet): string { - if(strtoupper($charSet) === 'UTF-8') { + $urlHost = $url->getHost(); + $charSetWrangle = function(string $input) use ($charSet, $urlHost): string { + // fuck it + if($urlHost === 'pixiv.net' || $urlHost === 'www.pixiv.net') { $decoded = mb_convert_encoding($input, 'ISO-8859-1', 'UTF-8'); - if(mb_check_encoding($decoded, 'UTF-8')) + if(mb_check_encoding($decoded, 'UTF-8') && str_repeat('?', strlen($decoded)) !== $decoded) return $decoded; }