Check for pixiv.net specifically, fuck this.

This commit is contained in:
Pachira 2023-10-22 17:46:25 +00:00
parent 842e91a413
commit d90e1e1c0b

View file

@ -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;
}