當我閱讀的RSS提要http://beersandbeans.com/feed/
字符編碼UTF8發行使用mb_detect_encoding()與PHP
飼料說,這是UTF8格式,我使用了SimplePie RSS當我搶的內容和店導入內容它$content
我執行以下操作:
<?php
header ('Content-type: text/html; charset=utf-8');
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head><body>
<?php
echo $content;
echo $enc = mb_detect_encoding($content, "UTF-8,ISO-8859-1", true);
echo $content = mb_convert_encoding($content, "UTF-8", $enc);
echo $enc = mb_detect_encoding($content, "UTF-8,ISO-8859-1", true);
?>
</body></html>
這就產生:
..... Camping: 2,000isk/day for 5 days) = $89 .....
ISO-8859-1
..... Camping: Â Â 2,000isk/day for 5 days) = $89 .....
UTF-8
爲什麼Ø輸出?
嘗試二者並沒有運氣:( – Lizard 2011-04-12 12:07:29
HM,工作對我來說...請與你的新嘗試 – Tobias 2011-04-12 12:08:48
添加udpated代碼 – Lizard 2011-04-12 12:13:45