Link to home
Start Free TrialLog in
Avatar of APD Toronto
APD TorontoFlag for Canada

asked on

PHPExcel UTF-8

Hi Experts,

How can I specify PHPExcel to use UTF-8?

Using PHPExcel I am trying to add chart, but as soon as I do I get "unreadable content" in Excel. With research I have found this Link.  To test this theory, I found that my generated file with PHPExcel and the Chart that open without issue on my iPad, but not on my Windows 7 x64 / Excel 2010.

How can I fix this issue?
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of APD Toronto

ASKER

In Notepad++ I checked, all m .php files are in UTF-8 without BOM

In phpMyAdmin, I see that all tables are utf8_general_ci

Does this cover your suggestions from above?

I thought this is a PHPExcel Setting, or something to do with the fact that I copying an existing file, opening the copied file, modifying it, then re-saving it?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How would I adapt this in PHPExcel - my scenario above?
It looks like you're swimming upstream to try using UTF-8 data with Microsoft applications.  You might want to ask "why do I need UTF-8?" and see if there is a way you can get get the job done without using UTF-8, perhaps by using a different encoding, then converting to UTF-8 only when required.  As noted, Microsoft is unhelpful, and the Stack reference is years old with little information.  What are the UTF-8 characters you need that cannot be represented in ISO-8859-1 or CP-1252?
It has nothing to do with characters. This issue originated when I created a chart in PHPExcel and as soon as I  added the following line I got unreadable content within Excel.

$excelWriterObj->setIncludeCharts(TRUE);

Within PHP I get no errors, and the file is created, but when I open the file in Excel 2010 under Windows 7 I get the above error and no chart.

When I open the same file on a MAC, there is no error and the chart is visible. The stack article suggesting UTF-8, and I also don't understand why, but I am just looking for a way to make the file work in Excel2010/Windows 7.
So you don't need PHPExcel to use UTF-8?  

Suggest you close this question and post a new one that says what you need.  I think if we have the original input data and a good picture of the desired output we might be able to suggest some good answers.  I thought this was about UTF-8, but maybe I was misunderstanding the problem.
But the stack solution was UTF8