aminembarki / php-excel-reader

Automatically exported from code.google.com/p/php-excel-reader
0 stars 0 forks source link

Wrong Encoding for values #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In version 2.11, the line 771 decides whether or not a string is ascii
encoded or not. As it seems this is not working reliably, for only UTF16LE
strings are "decoded" to the requested defaultEncoding.

My workaround/hack for now is to replace line 771 with this:

$retstr = ($asciiEncoding) ? iconv('cp1250', $this->_defaultEncoding,
$retstr) : $this->_encodeUTF16($retstr);

I'm not fully convinced using an hardcoded encoding of cp1250 is a good
idea but it seems to work in my testcase.

Original issue reported on code.google.com by arne.bla...@gmail.com on 4 Feb 2009 at 10:24

GoogleCodeExporter commented 9 years ago
I can confirm this works for me too going to UTF-8. It doesn't seem to matter 
if it
is cp1250 or ISO-8859-1. Now it seems to me that there should be a function 
similar
to _encodeUTF16 to support iconv or mb_convert_encoding. Attached is a sample 
file
you can test it with.

Original comment by rdalmul...@gmail.com on 31 Mar 2009 at 6:35

Attachments:

GoogleCodeExporter commented 9 years ago
Hi. This project is very good and useful. I have problem with the last version 
2.21.
I have .xls file with encoding Windows-1251 and I can`t make it to work 
correct. I
try this way and in new version is on line 1120. Can someone help me please?

Original comment by radostin...@gmail.com on 3 May 2009 at 6:22

GoogleCodeExporter commented 9 years ago
I correct it. Sorry for post. Just change the line 635 with 
$val = htmlentities($val,ENT_NOQUOTES, 'Windows-1251'); 

Now everything works fine. Thanks and best regards for great job on this 
project!

Original comment by radostin...@gmail.com on 3 May 2009 at 6:59

GoogleCodeExporter commented 9 years ago
If you set this "default" encoding to cp1250 it looks like everyting works, but 
there
is problem with some special character sets like RUSIAN, which can not be 
encoded by
CP1250. So when you have document with more encodings (like attachment) it is
impossible to read it properly

Original comment by marianba...@gtempaccount.com on 12 May 2009 at 3:44

Attachments:

GoogleCodeExporter commented 9 years ago
I think my patch in #31 should cover this issue as well.

Original comment by her...@ozuzo.net on 11 Jun 2009 at 8:08

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I encountered the same issues when dealing with both utf-8 and cyrillic 
character sets.

I came up with the following patch for the value() function - interested in 
people's thoughts on this.

Original comment by campbell...@gmail.com on 16 Dec 2010 at 11:36

Attachments:

GoogleCodeExporter commented 9 years ago
Use this patched version. Tested with several languages.

Original comment by olivier....@gmail.com on 31 Dec 2010 at 10:20

Attachments:

GoogleCodeExporter commented 9 years ago
answer #1 worked for me.

this was suggested in 2009 - is this project not supported anymore?

Original comment by kae.verens@gmail.com on 25 Apr 2011 at 12:36

GoogleCodeExporter commented 9 years ago
yes it is still, see php-excel-reader2

Original comment by ishtiaq....@gmail.com on 17 May 2011 at 10:30

GoogleCodeExporter commented 9 years ago
i got problem with ISO latin 1 

Notice: iconv(): Detected an illegal character in input string in 
/media/www/localsite/components/php-excel-reader-2.21/excel_reader2.php on line 
1718 
When i use Spreadsheet_Excel_Reader("file.xls",true,"ISO-8859-1");
and there is character €,²,°... in excel

Original comment by lazzyvn on 12 Aug 2011 at 10:15

GoogleCodeExporter commented 9 years ago
I can confirm that the code suggested in #1 works for me as well and that 
'cp1250' works even if the string is technically encoded with ISO-8859-1 (or 
Windows-1252? ... n-tilde is \0xF1).

Original comment by Lawrence...@gmail.com on 12 Dec 2011 at 10:03

GoogleCodeExporter commented 9 years ago
I hope it's the same problem as I had: In excel_reader2.php on line 824, replace

$val = htmlentities($val);

with

$val = htmlentities($val, ENT_COMPAT, 'UTF-8');

Original comment by dbr.sm...@gmail.com on 5 Jun 2012 at 8:22

GoogleCodeExporter commented 9 years ago
yes i find this problem.

Original comment by macapps....@gmail.com on 14 Oct 2012 at 9:41

GoogleCodeExporter commented 9 years ago
File excel_reader2.patch-cp1251.php works for me in cp1251 (e.g. 'ľ'). Thank 
you!

Original comment by abstract...@gmail.com on 15 Dec 2012 at 7:21

GoogleCodeExporter commented 9 years ago
Thank God, use #1 answer.

Original comment by mzva...@gmail.com on 17 Dec 2012 at 4:02