views:

829

answers:

4

I'm using the PHP-Excel-Reader library to read some XLS files and immediately have hit this issue:

PHP Notice: iconv() [function.iconv]: Detected an incomplete multibyte character in input string in C:\web\docs\housing\excel_reader2.php on line 1718

The line in question is this:

$result = iconv('UTF-16LE', $this->_defaultEncoding, $string);

And I've added some debugging info before that to help diagnose the problem:

var_dump($string);                   // string(10) "A�r�i�a�l�"
echo bin2hex($string) . "\n";        // 41007200690061006c00
echo $this->_defaultEncoding . "\n"; // UTF-8

I've tried changing to the _defaultEncoding to any number of random charsets but it obviously hasn't helped.

If anyone has any clues, please do help!

A: 

try :

$result = iconv('UTF-16LE', $this->_defaultEncoding . "//IGNORE", $string);
bader
yep, tried it, but it didn't work.
nickf
can you give an example of your xls file
bader
A: 

I realize this is an old post, but one thing to check is if there are any links in your excel file. I ran in to the exact same issue and it was solved by removing any hyperlinks from the excel file.

Chris Gutierrez
A: 

since it is a warning you may ignore it try this:

$result = @iconv('UTF-16LE', $this->_defaultEncoding, $string);

Steven Edward
A: 

I have the same problem with php-excel-Reader-2.21

function pruebaExcel(){ $correos = new Spreadsheet_Excel_Reader("modelo/correos.xls"); for($i=0;$i< $correos->rowcount();$i++){ echo "Correo:".$correos->value($i+1,1);

    }       
}

Notice: iconv(): Detected an incomplete multibyte character in input string in /var/www/modelo/php-excel-reader-2.21/excel_reader2.php on line 1718 Notice: iconv(): Detected an incomplete multibyte character in input string in /var/www/modelo/php-excel-reader-2.21/excel_reader2.php on line 1718 Notice: iconv(): Detected an incomplete multibyte character in input string in /var/www/modelo/php-excel-reader-2.21/excel_reader2.php on line 1718 Notice: iconv(): Detected an incomplete multibyte character in input string in /var/www/modelo/php-excel-reader-2.21/excel_reader2.php on line 1718 Notice: iconv(): Detected an incomplete multibyte character in input string in /var/www/modelo/php-excel-reader-2.21/excel_reader2.php on line 1718 Notice: iconv(): Detected an incomplete multibyte character in input string in /var/www/modelo/php-excel-reader-2.21/excel_reader2.php on line 1718 Correo:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]

Gabriel