MS Excell does not get along too well with UTF8 CSV, these files work
just fine with OpenOffice.
If OpenOffice is not an option I suggest you search on Google for a
possible workaround
(switch to a different type of encoding for output text with
mb_convert_encoding, UTF16 may work probably I have not
tried this myself) or some library that writes .xls files directly.
http://www.google.ro/search?q=php+excell+utf8

    gabriel

On Dec 15, 7:25 pm, axel at <[email protected]> wrote:
> hello,
>
> I try to export result rows (from admin-generator) to a csv file:
> public function csvExport($pager) {
> ...
> $this->getResponse()->clearHttpHeaders();
> $this->getResponse()->setHttpHeader('Content-Type', 'application/
> vnd.ms-excel;charset=utf-8');
> $this->getResponse()->setHttpHeader('Content-Disposition',
> 'attachment; filename='.$filename.'.csv');
> $this->setLayout(false);
> $this->setTemplate('csv');
>
>  $this->properties = array("firstname",
>                               "lastname",
>                                 ...);
>
> $this->results = $pager->getResults();
>
> cvsSuccess.php:
> ...
> <?php foreach ($results as $result): ?>
> <?php foreach ($properties as $property): ?><?php echo $result->get
> ($property); ?>;<?php endforeach; ?>
>
> <?php endforeach; ?>
>
> if I open the exported csv with ultraedit special characters are
> displayed correctly (dos-utf8 filteype)
> but when opend with ms-excel special chars are not displayed correctly
> (ä -> ö )
>
> settings.yml contains: charset: utf-8
>
> thx for your help

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.


Reply via email to