0

I am using utf8 char encoding - mysqli_set_charset($con,'utf8') in PHP file and utf8_czech_ci in MySQL.

I am programming on Windows computer and here is no problem. When I move my PHP application to Linux server, there is problem with bad character encoding (czech characters like ščřž...) in output Excel file.

koubin
  • 579
  • 5
  • 9
  • 30
  • Are you actually using the PHPExcel library? If so, you need to ensure that your values are UTF-8 before inserting them into cells... but it sounds as though your problem is before that point – Mark Baker Dec 09 '13 at 20:09
  • @MarkBaker yes, I'm using PHPexcel version 1.7.9. in MySQL DB are values stored as `utf8_czech_ci` and are took from there by `mysqli_fetch_assoc`. Then they are pass to excel sheet by `setCellValue`. Where do you thing is the problem? – koubin Dec 10 '13 at 01:09
  • I don't know for certain; but if PHPExcel is passed correct utf-8 values, then it has no coding issues because it is explicitly written to work with utf-8... you'll only have this problem if the values aren't valid utf-8 – Mark Baker Dec 10 '13 at 07:55
  • http://stackoverflow.com/questions/279170/utf-8-all-the-way-through – Mark Baker Dec 10 '13 at 08:07
  • What does [mb_detect_encoding()](http://www.php.net/function.mb-detect-encoding) make of your strings? – Mark Baker Dec 10 '13 at 08:18
  • mb_detect_encoding() output UTF-8 on my Win computer. I will try to send it to colegues on Linux server and then write result here – koubin Dec 10 '13 at 21:15
  • @MarkBaker so, colegues changed from changed from Excel5 to Excel2007 and they said now it's working. I have no access to Linux server to try something. Thanks for your help. – koubin Dec 13 '13 at 18:08

1 Answers1

0

Try this in your PHP function, I have solved from this command, It will release buffer memory before creating Excel file.

 ob_end_clean();
 ob_start();
Kavi Joshi
  • 173
  • 2
  • 5