<?php
header(`Content-Type: text/html; charset=utf-8`);
$url = "http://news.66163.com/fz/"; //目标站
$fp = @ fopen($url, "r") or die("超时");
$fcontents = file_get_contents($url);eregi("<div id=\"wz\">(.*)<a href=\"http://news.66163.com/2009-08-08/346352.shtml\" target=\"_blank\">", $fcontents, $regs);echo $regs[1];
?>如何将这个取到的内容转换成UTF-8
谢谢各位高手了

解决方案 »

  1.   

    Description
    string iconv ( string in_charset, string out_charset, string str)
    Performs a character set conversion on the string str from in_charset to out_charset. Returns the converted string or FALSE on failure. 例子 1. iconv() example:<?php
    echo iconv("看他之前什么编码写在这里", "UTF-8", "This is a test.");
    ?>   
      

  2.   

    <?php
    echo iconv("看他之前什么编码写在这里", "UTF-8", "This is a test.");
    ?>  
    这样的方法我好像试过``不行的吧
      

  3.   

    (PHP 4 >= 4.0.5)iconv -- Convert string to requested character encoding
    Description
    string iconv ( string in_charset, string out_charset, string str)
    Performs a character set conversion on the string str from in_charset to out_charset. Returns the converted string or FALSE on failure. 例子 1. iconv() example:<?php
    echo iconv("GB2312", "UTF-8", "This is a test.");
    ?>  
     直接这样就是了。
    把你所有的数据都转一遍就是了。http://blog.csdn.net/xssh913913/archive/2007/10/09/1816159.aspx