Problem with mutated vowel / german Umlaut

Topics: Developer Forum
Jul 31, 2011 at 9:21 PM

Hello together,

I got an issue, that the german umlaut (mutated vowel) is not processed by this class. Where can I change it?

Kind regards

STX

May 9, 2012 at 4:58 PM

hello,

may be i have same issue...i'm reading CSV file which contains special characters.

actually all works just fine except if column string starts with special character - then it is omited from read data (if special character is located inside string then it's imported correctly)

i tried various encodings of source file but none worked.

my code looks like this:

require_once('PHPExcel/PHPExcel.php');
$import_file = 'test.csv';
PHPExcel_Settings::setCacheStorageMethod(PHPExcel_CachedObjectStorageFactory::cache_in_memory_gzip);
$objReader = PHPExcel_IOFactory::createReader('CSV')
                ->setDelimiter(";")
                ->setEnclosure('')
                ->setLineEnding("\n")
                ->setSheetIndex(0);
$objReader->setInputEncoding('UTF-8');
$xlsObject = $objReader->load($import_file);
$objWorksheet = $xlsObject->getActiveSheet();
foreach ($objWorksheet->getRowIterator() as $k1 => $row) {
 $cellIterator = $row->getCellIterator();
 $cellIterator->setIterateOnlyExistingCells(false);
 $row = array();
 $filled = false;
 foreach ($cellIterator as $k2 => $cell) {
  $value = $cell->getValue();
  echo '-'.$value.'-';
 }
}
in test.csv file is for example only "öxöx" string
thx and regards
Sep 26, 2013 at 12:22 PM
Hi,
I have the same problem while reading from a database it stops at the german umlaut (mutated vowel). Any solutions yet?
tredsa
Coordinator
Sep 26, 2013 at 1:18 PM
If somebody can explain exactly what the problem is (preferably with a working example that I can test rather than having to flail about in the dark looking for something somewhere that isn't right), and the problem is in PHPExcel itself, then I will fix it.

PHPExcel uses UTF-8 internally.

If you are loading non-UTF-8 data from a file, then PHPExcel needs to know what charset it is so that it can be converted to UTF-8.

If you are taking data from a database to add to a PHPExcel object, then the values you set in PHPExcel must be UTF-8 values
Oct 8, 2013 at 10:18 AM
Hi,

i have problem, when i try to read .csv file contains subscript or superscript values (km²,cm²,Å) PHPExcel library returns wrong values.

below is my code:-
$objReader = PHPExcel_IOFactory::createReader('CSV');
$objReader->setInputEncoding('ISO-8859-1');
$objReader->setDelimiter(','); 
$objReader->setEnclosure('');
$objReader->setLineEnding("\r\n");
$objReader->setSheetIndex(0);
$objPHPExcel = @PHPExcel_IOFactory::load($_FILES['logo']['tmp_name']);

$sheetData = $objPHPExcel->getActiveSheet()->toArray();