i've been using phpexcel months now. have users entering unicode data, , reports not opening in excel.
the exact error excel 2010 gives is: excel found unreadable content in 'blahblahblah.xlsx'. want recover contents of workbook? if trust source of workbook, click yes.
clicking yes... file corrupt , cannot opened.
when view files (turn .zip , open .xml contents), can see formatted. utf-8 characters show in text editor (an accented "o" shows xc3 single item), encodings seem kill excel.
i've noticed unicode used in both cells , sheet names.
the solution i'm going use (though not perfect):
function phpexcel_unicodefix($value) { //data seems utf-8, despite internal encoding // $iconv = iconv_get_encoding(); // $it = $iconv['internal_encoding']; //such $it == 'iso-8859-1' //but iconv($it,"ascii//translit",$value) doesn't work (data utf-8?) //excel not accept utf-8? $value_fixed = iconv("utf-8","ascii//translit",$value); return $value_fixed; }
i tried many combinations of iconv() before found work. thought utf-8 valid phpexcel, wasn't working. conversion isn't perfect, readable.
Comments
Post a Comment