您好,欢迎访问一九零五行业门户网

一个php编码转换类的问题

这是一段实现乱码自动转换为中文的自定义类changcode
input = $input;
$this->output = $output;
}
protected function chgcode($str){
if($this->input != ''){
$this->str = iconv($input,$output,$str);
}else{
$this->str = mb_convert_encoding($str,$output);
}
}
function getstr($str){
$this->chgcode($str);
return $this->str;
}
function setinput($input){
$this->input = $input;
}
function setoutput($output){
$this->output = $output;
}
function getinput(){
return $this->input;
}
function getoutput(){
return $this->output;
}
}
?>
我的问题是怎么调用这段代码实现转换为中文貌似不管用
$str=;//这是繁体字
$test=new changecode();
echo $test -> getstr($str);
我想知道为什么还是输出繁体字
回复讨论(解决方案) 是不是因为setinput也要指定big5呢?
好像也不管用啊,求助,在线等
你这个程序只是转编码,与简繁没有关系。
简繁转换是需要有对照表的。
贴出的程序转码而已,繁体转简体参照
http://download.csdn.net/detail/very68com/5895009
你需要有个简繁对应表,例如gb2big.map
其它类似信息

推荐信息