PHPExcel Csv阅读器设置编码

时间:2019-06-27 11:09:30

标签: php csv phpexcel

到目前为止,我已经知道了,但是当我从csv中读取时,我得到一个空值,因为它是非utf-8编码的csv文件。

public function process_woe() 
{
 $objPHPExcel   = new PHPExcel();
 $woe_processed = $objPHPExcel->setActiveSheetIndex( 0 );
 $objReader     = PHPExcel_IOFactory::load( $this->woe_filepath );
 $woe           = $objReader->getActiveSheet();
 $rcount        = 1;
 $rncount       = 1;

}

当我尝试以utf-8编码写入时,此字符串返回一个空字符串:

"Caruso�s Prostate EZE MAX health indications:
� Management of symptoms Medically Diagnosed Prostate Enlargement
� Prostate gland health                                                                                  
� Antioxidant for the prostate gland" 

当我尝试使用setInputEncoding()时出现错误,例如:

$objReader->setInputEncoding('ISO');
$woe->setInputEncoding('ISO-8859-7');
$woe->setInputEncoding('ISO-8859-1'); 

Fatal error: Uncaught Error: Call to undefined method PHPExcel_Worksheet::setInputEncoding() – 

1 个答案:

答案 0 :(得分:0)

感谢帮助人员!选择更改我的插件