Comments (3)
I tried parsing that file with your code and it seems to have worked without any errors for me.
Are you sure that's the same file you're getting the error on? It looks like the file doesn't even contain any quote characters, so it's strange to have it report an error related to that.
One possibility is maybe there's something wrong with the string encoding? I'd double check that the string you're passing into that method matches what's in the file (or whatever source you're reading from).
You could also try explicitly passing in the encoding you're using to see if that makes any difference:
parser = new CsvTextFieldParser(stream, Encoding.Default);
Or since you have the data as a string already, a StringReader
might be easier to use than a MemoryStream:
var reader = new StringReader(dataContent);
parser = new CsvTextFieldParser(reader);
from csvtextfieldparser.
I tried parsing that file with your code and it seems to have worked without any errors for me.
Sorry, wrong file. This one is correct link to the problematic file: https://www.theice.com/api/productguide/info/codes/all/csv
from csvtextfieldparser.
It looks like this parser and the VB version are consistent with throwing an error for that file. The line at 318 looks roughly like this:
"=HYPERLINK(""http://url"",""Coffee "C" Calendar Spread Option"")","4137","KC1, KC2","KC1, KC2","","","Coffee","Coffee C","ICUS","IFUS","Coffee C"
The problem is the double quotes in the first Coffee "C"
. You're already in a quoted field at that point, so the the first field ends up being just this:
"=HYPERLINK(""http://url"",""Coffee "
That's immediately followed by the C
, which is what causes the error. At that point the parser is expecting a comma, newline, or end of file.
See the error handling section of the readme for more details about parser errors.
from csvtextfieldparser.
Related Issues (14)
- add some constructor parameters HOT 3
- Assembly signing HOT 2
- Thanks! HOT 2
- Item order in subsequent iterations? HOT 2
- This parser doesn't support multiple delimiters HOT 1
- Suggestion: Include a CsvTextFileFormatter as well? HOT 1
- Can you please add ReadLine() method? HOT 3
- No errorLine is shown when thrown MalformedException HOT 3
- Parsing difference between VB parser and this parser HOT 1
- Feature Request: LineNumber property HOT 1
- Issue with line parsing HOT 1
- TrimWhiteSpace default value HOT 3
- Error: is too long, or a component of the specified path is too long. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csvtextfieldparser.