主题:  PHP读写txt文件时乱码!

einha

职务:普通成员
等级:2
金币:5.5
发贴:532
注册:2004/6/14 8:32:32
#12005/12/31 10:03:35
PHP向txt写入中文时乱码,读出显示亦乱码,如何解决?
txt编码UTF-8与ANSI均乱码。
谢谢。



{ 在指尖上绽放的花朵 }

职务:普通成员
等级:5
金币:14.0
发贴:3209
注册:2002/7/25 21:24:11
#22006/1/3 4:04:36
试试看这个程序写的会不会乱。。。?

顺便。。。你什么 Web Server 。。。?

<?php
//================================================
// Program Written By xingzhe @5d.cn, 2006.
//================================================

	// initialize variables
	$the_written_file = "temp.txt";
	$the_written_str  = "行者宇宙超级霹雳无敌";
		
	// open the file
	$handle = fopen($the_written_file,"w");

	// write
	fputs($handle,$the_written_str);

	// close the file
	fclose($handle);

?>



einha

职务:普通成员
等级:2
金币:5.5
发贴:532
注册:2004/6/14 8:32:32
#32006/1/3 13:03:18
Apache

我是从web页提交一段中文,写入txt,写入后是乱码。
是不是二者编码不一致引起的?



{ 在指尖上绽放的花朵 }

职务:普通成员
等级:5
金币:14.0
发贴:3209
注册:2002/7/25 21:24:11
#42006/1/8 0:33:19
nod 。。。必然是这样了。。。