0

I’m trying to read and parse a UTF-8 Excel file using the PHPExcelReader but unfortunately this does not work correctly and I receive some ???? Instead of UTF-8 characters. Would you please help me about the instructions about the way to handle this situation? I have used this configuration for my parsing:

$data = new Spreadsheet_Excel_Reader(); $data->setOutputEncoding('CP1251'); $data->setUTFEncoder('mb'); 

Thanks

1
  • Why CP1251 if you want UTF-8? What characters should it output instead of "???"?
    – deceze
    CommentedJan 1, 2012 at 11:35

2 Answers 2

1

UTF-8 is the default encoding for Spreadsheet_Excel_Reader...you should not need to change this at all unless you want the values automatically converted to some other charset.

e.g.

$data = new Spreadsheet_Excel_Reader("test.xls",true,"UTF-16"); 

to convert outputs to UTF-16

    1

    I tried UTF-16 but there's still an error.

    Then I tried:

    $data->setOutputEncoding('UTF-8'); $data = new Spreadsheet_Excel_Reader("test.xls",true,"UTF-8"); 

    This is ok.

    1
    • $excel = new PhpExcelReader(); $excel->setOutputEncoding('UTF-8'); This worked for me after hours of different trials. Thank You.
      – Nilesh
      CommentedMar 13, 2019 at 13:34

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.