0

I need help with encoding "Title" tag. I have name with special character, like "ě, š, č, ř, ž, ý, á, í, é" and in demo.browse.php is working. There is my code and I dont know, where is the problem, please, Can you help me? :) thanks

<?php
require_once('getid3.php');
$PageEncoding = 'UTF-8';
$getID3 = new getID3;
$getID3->setOption(array('encoding' => $PageEncoding));
$FullFileName = "test.webm";
$ThisFileInfo = $getID3->analyze($FullFileName);
getid3_lib::CopyTagsToComments($ThisFileInfo);

echo '<html><head>';
echo '<title>getID3() - (sample script)</title>';
echo '<meta http-equiv="Content-Type" content="text/html;charset='.$PageEncoding.'" />';
echo '</head><body>';

echo htmlentities(!empty($ThisFileInfo['comments_html']['title'])?implode('<br>', $ThisFileInfo['comments_html']['title']) : chr(160));

echo '</body></html>';
?>

resoult is: "V zajet& #237; d& #233;mon&# 367;"
And original is: "V zajetí démonů"
I try iconv(); and utf8_encode(); dont work. Thanks

1 Answers1

0

You call htmlentities on the result yourself. This call converts diacritics to respective HTML entities.

Use htmlspecialchars instead.

Aleksei Matiushkin
  • 119,336
  • 10
  • 100
  • 160
  • dont working echo htmlspecialchars(!empty($ThisFileInfo['comments_html']['title'])?implode('
    ', $ThisFileInfo['comments_html']['title']) : chr(160), ENT_QUOTES ,'ISO-8859-2', true);
    – Kemo Jeff Oct 06 '14 at 12:41
  • Why `'ISO-8859-2'`? Use `UTF-8`. – Aleksei Matiushkin Oct 06 '14 at 12:44
  • What do you mean another way? Also, double encoding should be turned off (last param in call to `htmlspecialchars` set to false.) It this would not help, get rid of call to `htmlspecialchars` at all. It should work fine without it. – Aleksei Matiushkin Oct 06 '14 at 12:54
  • done... I must use **comments** instead comments_html. thank you for help – Kemo Jeff Oct 06 '14 at 13:11