Closed paxter closed 3 years ago
Imdb seems to be only escaping characters that mean something to html, so I think htmlspecialchars_decode is an appropriate function to use here. Non ascii characters are represented as UTF-8. Seems like a silly mistake in PHP someone made a long time ago probably with good intentions to exclude single quotes from these functions .. it's been fixed very recently though https://php.watch/versions/8.1/html-entity-default-value-changes
php > $a = '&"''';
php > echo htmlspecialchars_decode($a);
&"''
php > echo html_entity_decode($a);
&"''
php > echo html_entity_decode($a, ENT_QUOTES, 'UTF-8');
&"''
php > echo htmlspecialchars_decode($a, ENT_QUOTES);
&"''
Some examples of
Nausicaä of the Valley of the Wind
Forhøret
"Firefly" The Train Job (TV Episode 2002)
While the Rest of Us Die: Secrets of America's Shadow Government
Thanks for your fast reply. Your provided solution is working for me too. 👍
Using: https://www.imdb.com/title/tt13950332/
Test code
Getting
Expecting
I took a look into the code and I could identify the following line in the
title_year()
function: https://github.com/tboothman/imdbphp/blob/0074d4cda918e910fd9a43a37b335a6fd9fa294f/src/Imdb/Title.php#L236To get it working properly I replaced the line with:
I'm not sure if this is the proper or best solution, but it worked in my case. There are some other usages of
htmlspecialchars_decode()
in that function I have replaced too.