Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to write euro('€') to a excel file using Spreadsheet_Excel_writer

21 views
Skip to first unread message

kyt...@gmail.com

unread,
Jun 30, 2008, 10:31:48 PM6/30/08
to
Hi, everyone:
I use Spreadsheet_Excel_writer to export my page data into a
excle file, but I found the Euro('€') can not be exported correctly, I
have tried many ways to write it into a cell of excel, but it still
shows a "?" in the cell.
My LAMP is apache 1.3.29, PHP 4.3.11 and MySQL 4.1, my talbe
coding is utf-8, I have used utf8-decode to decode the data from
Mysql, for example:
$reponse_libelle = utf8_decode($reponse);
$worksheet->writeString($current_row, $current_col+$count,
$reponse_libelle, $this->format_list['rubrique_cell3']);

I need help, how to write the ('€') correctly.

Willem Bogaerts

unread,
Jul 1, 2008, 3:25:59 AM7/1/08
to

From the top of my head, utf8_decode translates utf8 into latin-1. The
euro character is not in the limited set of characters that form
latin-1. So this function will not work for euro signs.

Some Microsoft programs have a nasty "feature" of using a different
character set where latin-1 is specified (and I do not know which
encoding Excell uses). It will then take the place of the non-breaking
space at position 128. So you might want to try a hack...

Good luck,
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/

Peter H. Coffin

unread,
Jul 1, 2008, 9:47:06 AM7/1/08
to

I think he'll need it. The PEAR tool writes files in BIFF5, and I
don't think unicode support was added until BIFF8. You can do it with
perl's Spreadsheet::WriteExcel package (write_utf16be_string and
write_utf16le_string methods), but that'd take calling an external
interpreter to do the whole generation externally to the PHP script.

Luck may still work, though, given the misfeature you mentioned... (:

--
"'I'm not sleeping with a jr. high schooler! I have a life-sized doll that
looks like one.' Uh huh. That sounds SO much less pathetic."
-- Piro's Conscience www.megatokyo.com

maxence....@gmail.com

unread,
Aug 26, 2008, 5:57:10 AM8/26/08
to
Excel use cp1252. The code for euro symbol is 128. Use the php
function chr(128) to encode your euro symbol.

0 new messages