PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » File Formats » Spreadsheet_Excel_Writer » Bug #6606

Special Chars for example ¤ (euro)are not encoded correctly

Details

Submitted2006-01-27 14:44 UTC
Froms dot tiplady at lottery24 dot net
StatusBogus
PackageSpreadsheet_Excel_Writer
PHP Version4.3.4
OSWindows XP Pro
Roadmaps(Not assigned)

Comments

[2006-01-27 14:44 UTC] s dot tiplady at lottery24 dot net

Description:
------------
When using the Spreadsheet_Excel_Writer module I need to format cells (for example currecy formating a number) with the EURO sign € but even after attempting to change the input encoding with setInputEncoding('utf-8'); (the same encoding as the script file) the symbol is not shown at all. When I try to write() the euro sign to the file I get either nothing, ? or "€" or sometimes "¬";

The test script given below fails with any combination of

$worksheet->setInputEncoding('UTF-8');
$worksheet->write(0,0,utf8_encode('€'));
$worksheet->write(0,0,'€');

the encoding of our source code is always utf-8 with unix line endings

Test script:
---------------
$workbook = new Spreadsheet_Excel_Writer();
$worksheet =& $workbook->addWorksheet();
$worksheet->setInputEncoding('UTF-8');
$worksheet->write(0,0,'€');
$workbook->send('face.xls');
$workbook->close();

Expected result:
----------------
I expect to see the Euro symbol, I`m not sure what other symbols also fail as this is the only one i need.

Actual result:
--------------
any of the following outputs occur in the cells

€

¬

?

or nothing

[2006-02-13 09:26 UTC] s dot tiplady at lottery24 dot net

in this report the characters (â�¬) should have displayed the equivalent of the html &euro €

[2006-03-14 18:04 UTC] danielpeake at hotmail dot com

From your test script it looks like you just forgot to set the BIFF (Excel file format) version to 8. Try:

$workbook->setVersion(8);

You need to do this because only BIFF8 can store unicode characters (like the Euro symbol).

[2006-03-15 11:22 UTC] s dot tiplady at lottery24 dot net

Thanks for the comment, I hadn`t tried setting the biff version.

When I set the biff to version 8 as you suggested, the euro symbol appears correctly.

However when I set left,right,top and bottom boders on a cell, I also get the diagonal borders, this also happens when I just set top and left or any other perpendicular set of borders?

The borders work without problem if I dont set the biff version.

???

[2006-10-16 12:58 UTC] s dot tiplady at lottery24 dot net

Bogus