[英]In php how to display chinese character?
what I build now is I grabbing from RSS feed in chinese RSS website, but once I echo out is blank, my code was work on english RSS, I try a lot of decode,iconv, header("Content-Type: text/html; charset=utf-8");, but still the same cannot display any chinese word on my screen. 我现在建立的是我从中国RSS网站的RSS提取中获取,但是一旦我回应出来是空白的,我的代码是在英文RSS上工作,我尝试了很多解码,iconv,标题(“Content-Type:text / html ; charset = utf-8“);,但仍然不能在我的屏幕上显示任何中文单词。
here is my coding: 这是我的编码:
header("Content-Type: text/html; charset=utf-8");
function getrssfeed($feed_url){
$Current = date("Y-m-d" ,strtotime("now"));
$content = file_get_contents($feed_url);
$xml = new SimpleXmlElement($content);
$body = "";
foreach($xml->channel->item as $entry){
$body .= get_html_translation_table(htmlspecialchars_decode(strip_tags($Current ." ". $entry->description))) . "\n\n";
//$result = iconv('UTF-8', 'ISO-8859-1//TRANSLIT//IGNORE', $body);
$i++;
if($i==5) {
break;
}
}
echo $body;
}
getrssFeed("http://news.baidu.com/n?cmd=1&class=enternews&tn=rss"); getrssFeed( “http://news.baidu.com/n?cmd=1&class=enternews&tn=rss”);
Can you guy help me how to solve my problem ? 你能帮助我解决问题吗?
thank you 谢谢
在你的HTML标题中放这个
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" ></meta>
Two things you need to do 你需要做的两件事
content="text/html;charset=utf-8"
含量= “text / html的;字符集= UTF-8”
may be you can use this function with 也许你可以使用这个功能
mb_convert_encoding
mb_convert_encoding
,but at the same time ,you should attention the native document charset must be utf-8 or gb2312 ,但与此同时,你应该注意本机文件字符集必须是utf-8或gb2312
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.