mageddo / javascript-csv

Automatically exported from code.google.com/p/jquery-csv
MIT License
1 stars 1 forks source link

CSVDataError: Illegal State - Only in IE #39

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
I have implemented a script using this plugin to parse a CSV file and 
manipulate the data using jQuery.  This works perfectly fine in FireFox and 
Chrome but is failing in IE with the error of "CSVDataError: Illegal State" 
just below the "// broken paser?" line in the jquery.csv.js file.

What is the expected output? What do you see instead?
The expected output is the working page that I see in FireFox and Chrome 
without any problems.  In IE, this causes the entire file to fail to load.  If 
I comment out the "throw new Error()" lines, it won't throw an error anymore 
but still fails to load properly.

Please provide any additional information below.
I can't share the code/CSV file for confidentiality reasons as this is an 
internal resource at my company.  However, this does work perfectly fine 
without any errors in FireFox and Chrome on both Windows and Mac.  It seems to 
be solely isolated in IE and the version of IE used doesn't seem to make any 
difference.

Original issue reported on code.google.com by jacklynw...@gmail.com on 4 Apr 2014 at 4:32

GoogleCodeExporter commented 8 years ago
It appears that this was an issue caused by french characters (é, à, etc.).  
FireFox and Chrome handled these characters without any problems but IE 
continued to fail, regardless of any charset used with the ajax call.  
Stripping the file of any french characters appears to resolve the issue.  It 
would be much appreciated if further support could be implemented to prevent 
this from being an issue as additional steps need to be taken now when 
generating the CSV file to ensure there are no French characters.

Original comment by jacklynw...@gmail.com on 8 Apr 2014 at 1:15

GoogleCodeExporter commented 8 years ago
Are you reading the data from a file or an AJAX request? If so, are you setting 
the encoding to utf8.

AFAIK, the parser should work with utf8. If it's not working with utf8 then 
perhaps a change can be made to fix the issue. 

Excluding french-specific chars shouldn't be necessary

Original comment by evanpla...@gmail.com on 29 May 2014 at 3:05

GoogleCodeExporter commented 8 years ago
It appears that -- in older versions of IE -- if you don't force Internet 
Explorer to use the UTF8 encoding, it will default to whatever language the 
browser client uses. For example, if you're using a french version of IE the 
browser will default to using a french-specific encoding.

You may try to set the encoding explicitly in the HTML header with:
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Source: [UTF-8 encoding does not work properly with Internet Explorer but works 
perfectly with Mozilla Firefox](http://stackoverflow.com/q/9999381/290340)

Original comment by evanpla...@gmail.com on 29 May 2014 at 3:10