Notice: iconv(): Detected an incomplete multibyte character in input string in Excel_reader.php

4.2k views Asked by At

Excel_reader.php:

function _encodeUTF16($string) {
$result = $string;
    if ($this->_defaultEncoding){
        switch ($this->_encoderFunction){
            case 'iconv' :   $result = iconv('UTF-16LE', $this->_defaultEncoding, $string);
                            break;
            case 'mb_convert_encoding' :     $result = mb_convert_encoding($string, $this->_defaultEncoding, 'UTF-16LE' );
                            break;
        }
    }
return $result;

The notice showing on this line:

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

I replaced this line with this also

iconv('UTF-8', "ISO-8859-1//IGNORE", $string);

The notice got removed but my excel sheet not got imported.

My excel sheet is not getting imported now, it was working fine until someday before. & It does work in localhost but not in server. How can i import my excel sheet again ??

1

There are 1 answers

0
weera On

I simply changed it to this:

case 'iconv' :   $result = iconv('UTF-8', $this->_defaultEncoding, $string);

and it works.