5

Can you help me with problem writtent below:

I am getting error iconv() [function.iconv]: Detected an illegal character in input string when i am reading xls file and converting it into csv. I am using php-excel-library and i get this error in line:

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

Does enybody know how to fix it?

2 Answers 2

2

It means that in your file is a bit-sequence that cannot be mapped onto a char, b/c it's meaningless, and therefore not be converted to another encoding.

Use the //IGNORE-flag as descriped here.

Sign up to request clarification or add additional context in comments.

1 Comment

i also try this with no success
0

Be sure the file is UTF-16LE encoded as trying to import the wrong format will throw those kinds of errors.

Use PHP 5.3 or greater, as PHP < 5.3 cannot handle UTF-16 encoding (check the notes here: link)

Instead of ignore you may want to try //TRANSLIT to have iconv convert the character to one that is compatible in your default encoding (eg, convert MS "fancy quotes" to regular single/double quotes in ascii)

2 Comments

I have installed php 5.3.8 and I tried //TRANSLIT, and it doesn't work
Have you been able to identify the offending character? Try debugging to find out what line of the file it's on and narrow down what character is bad. That was my first step in figuring it out. If you can find the offending character(s) you might be able to track down what the problem with the encoding is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.