This is a custom class that implements garbled characters automatically converted to Chinese Changcode
Class changecode{
Private $str;
Private $input;
Private $output;
function __construct ($input = "", $output = ' gb2312 ') {
$this->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;
}
}
?>
My question is how to call this code implementation to convert to Chinese doesn't seem to work.
$str = "??"; /This is a traditional
$test =new ChangeCode ();
Echo $test-Getstr ($STR);
I want to know why I'm still exporting traditional Chinese.
Reply to discussion (solution)
Is it because SetInput also want to designate BIG5?
It doesn't seem to work, help, online, etc.
Your program is just transcoding, not related to Jianfan.
The conversion of simple and complex needs to have a comparison table.
Posted program transcoding just, traditional transfer simplified reference
http://download.csdn.net/detail/very68com/5895009
You need to have a simple and complex table, such as Gb2big.map