duanliang1898 2014-10-06 12:15
浏览 56

getID3()ASCII和UTF-8

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条回答 默认 最新

  • douren9077 2014-10-06 12:24
    关注

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

    Use htmlspecialchars instead.

    评论

报告相同问题?

悬赏问题

  • ¥15 运筹学排序问题中的在线排序
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧