Export to GitHub

php-excel - issue #7

utf8_encode of cyrillic characters


Posted on Sep 20, 2007 by Happy Giraffe

What steps will reproduce the problem? 1. input cyrillic characters in the array 2. save the file as UTF-8 3. run it

What is the expected output? What do you see instead? xls file - the text is corrupt

What version of the product are you using? On what operating system? php-excel Version 1.0

Please provide any additional information below. Try without utf8_encode(); I guess the strings in the array "should" be UTF-8 and utf8_encode() is not necessary.

Comment #1

Posted on Sep 10, 2009 by Swift Horse

Thanks for your input! This was definitely an error I made when first starting out with the library. This library can not solve all the different localization tasks when it comes to different character sets. I have removed the utf8_encode() from the code and added the option to set the global charset yourself in the branch of version 2:

http://code.google.com/p/php-excel/source/browse/#svn/branches/version02

When invoking the library you may set a new parameter in the constructor:

$xls = new Excel_XML('ISO-8859-2');

All headers of the output document will be set accordingly. It'd be great if you could check this with cyrillic charset - this will be difficult to test for me.

The best way, nonetheless, will be to deliver native UTF-8 in the input array ;)

Comment #2

Posted on Sep 10, 2009 by Swift Horse

I will address this issue with a new version and/or a patch for version 1.

Comment #3

Posted on Sep 10, 2009 by Swift Horse

I have removed the utf8_encode from version 1.1 which is available now in the [http://code.google.com/p/php-excel/downloads/list download section] of the project. Additionally you may set the desired encoding in the constructor of the file. See the attached readme.txt for details.

I still need to validate this with other charsets.

Status: Fixed

Labels:
Type-Defect Priority-Medium