php上传txt时候,能不能把ansi转换成unicode,啊。因为我要把数据显示在flash里。flash只支持unicode,不要用$uploadfile = iconv('gbk','utf-8//ignore', $uploadfile);这样无效 还是显示乱码
  “ ½ð±̻Ի͵ŬµîÀ¼¸¸ùÇæÌìÓñÖù¸ßËÊÈëÔƣ¬¹¬µîÍ⵽´¦ÊÇһƬÔÆÎíçÔÈƣ¬±̳ØÀïֲÂúÁËÓñÁ«£¬ʱ²»ʱ»¹¿ÉÒԿ´¼û¼¸ֻÏɺ׷ɹý±¼ÉÏÌìµľ¡ͷ£¬ÕâÀﲻÊDZ

解决方案 »

  1.   

    mb_convert_encoding($content, 'gbk',mb_detect_encoding($content, 'gbk, US-ASCII', true))
      

  2.   

    $content=file_get_contents($_FILES['fileField']['tmp_name']);//读取上传文件内容
    $content= iconv('gbk','utf-8//ignore', $content);//转换成 utf-8(你怎么知道一定是gbk编码的)
    file_put_contents($uploadfile, $content);//保存文件
      

  3.   

    看过你回复的一篇帖子说中文gbk,繁文big5,你说编码和操作系统同步,我现在的问题是上传本地txt小说到服务器,然后用flash读出来,flash只认unicode,我发现所有txt的小说都是ansi格式的啊,那我该怎么办?头痛,没有基础好吃力
      

  4.   

    mb_convert_encoding ( $str, 'GBK','Unicode');把文件读出来做个转换然后再保存回去文件 不可以嘛?老徐2楼有代码了
      

  5.   

    徐哥,代码,$file_put_content()提示错误,function name must be a string
      

  6.   

    徐哥,代码,$file_put_content()提示错误,function name must be a string
      

  7.   

    file_put_content !!!
    怎么前面有个 $ ????
      

  8.   

    汗,多些了个,问题解决了。辛苦了,徐哥,也谢谢newnew
      

  9.   

    汗,多些了个,问题解决了。辛苦了,徐哥,也谢谢newnew