You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
when program is utf-8,but remote page is gbk , the wrong has occur #232
My program is utf-8 no bom encode,i get remote site is gbk encode,ex
http://tieba.baidu.com/f?ie=utf-8&kw=奇迹篮球
my code is :
<code>
$url="http://tieba.baidu.com/f?ie=utf-8&kw=奇迹篮球";
phpQuery::newDocumentFileHTML($url,'gbk');
$t = pq('title')->html();
echo mb_detect_encoding ($t);// result is : UTF-8
echo $t; // this is unreadable code
</code>
i try some function ... but not find .. so i write a function
<code>
function d_di8_open( $url )
{
$cnt = file_get_contents($url);
return mb_convert_encoding($cnt ,"UTF-8","GBK");
}
$url="http://tieba.baidu.com/f?ie=utf-8&kw=奇迹篮球";
phpQuery::newDocumentHTML( d_di8_open($url) );
$t = pq('title')->html();
echo mb_detect_encoding ($t);// result is : UTF-8
echo $t; // this is right
</code>
so i think phpquery had a bug ....
Original issue reported on code.google.com by [email protected] on 26 Aug 2013 at 11:08
Activity