新手转码有关问题

WBOY
Release: 2016-06-13 12:31:15
Original
969 people have browsed it

新手转码问题

<br />
	$url='test.txt';<br />
	$read = fopen($url,'r') or die('打开失败');<br />
	$text=fread($read,100);<br />
	fclose($read);<br />
	echo iconv('UTF-8','GBK','这是一个测试').'<br/>';#这句OK<br />
	echo iconv('UTF-8','GBK',$text).'<br/>';#这句报错<br />
Copy after login


以上第一个echo正常,第二个echo就老是报以下错误:
 Notice: iconv(): Detected an illegal character in input string

test.txt文件为UTF-8格式。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template