Umlauts in SYLK file

Topics: User Forum
Dec 3, 2009 at 8:20 PM


I'm trying to read some mixed german/italian SYLK files. Unfortunatly, Umlauts get scarambled. "Öffentliches Grün" becomes "HOffentliches GrHun".

Do I need to specify the encoding of the file? And how can I do this?

The code is:

include 'PHPExcel.php';
include 'PHPExcel/IOFactory.php';

$objReader = PHPExcel_IOFactory::createReader('SYLK');
$workbook = $objReader->load('../docs/immobili.sylk');
$worksheet = $workbook->getActiveSheet();
$highestRow = $worksheet->getHighestRow();

for($row = 1; $row <= $highestRow; $row++) {
    echo $worksheet->getCellByColumnAndRow(5, $row)->getValue()."\n";





Dec 4, 2009 at 3:32 PM

Issued item # 11038 from this

Jan 21, 2010 at 5:28 AM

Adding hyperlink to work item.

Aug 18, 2011 at 4:20 PM

LibreOffice and for some reason seem to export SYLK files with their existing character encoding (like say UTF8) rather than ANSI.

So when PHPExcel hits a non-ANSI character in a SYLK cell, the cell is truncated.

I filed a bug with LibreOffice, but it'd be nice if PHPExcel worked for these anyway.

Aug 18, 2011 at 6:15 PM

If I just change some code in SYLK.php to this...

// convert SYLK encoded $rowData to UTF-8
$rowData = iconv("Windows-1252", "UTF-8", $rowData); // new
$rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData); works great, but maybe just because I saved to SYLK in LibreOffice on a Windows box...