php 如何正确读取unicode文件 并转换成utf8输出 - 技术问答

[ol][*]$file_dir=\"upload/\".$ty_code.\"/\".$fileName; [*]$fp = fopen($file_dir, \'r\');[*]? ?? ???while(!feof($fp)){[*]? ?? ???$in=fgets($fp);[*]? ?? ?? ?? ?? ? echo? ?$in;? ?? ?? ?? ?? ? [*]? ?? ???}[*]? ?? ???fclose($fp);??[*] $out = mb_convert_encoding($in, \'UTF-8\', \'UNICODE\');[/ol]这样的结果是只能输入一行数据

[ol][*]? ?1. $file_dir=\"upload/\".$ty_code.\"/\".$fileName;[*]? ?2. $fp = fopen($file_dir, \'r\');[*]? ?3.? ?? ?? ?while(!feof($fp)){[*]? ?4.? ?? ?? ?$in=fgets($fp);[*]? ?5.? ?? ?? ?? ?? ???echo? ?$in.\"\";? ?? ?? ?? ?? ?[*]? ?6.? ?? ?? ?}[*]? ?7.? ?? ?? ?fclose($fp);??[*]? ?8. $out = mb_convert_encoding($in, \'UTF-8\', \'UNICODE\');[/ol]这样可以输入全部显示。但是转编码后为乱码
温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网