Code Monkey home page Code Monkey logo

Comments (3)

22222 avatar 22222 commented on July 28, 2024

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.

Krakean avatar Krakean commented on July 28, 2024

@22222

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.

22222 avatar 22222 commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.