Coder Social home page Coder Social logo

Comments (11)

JoshClose avatar JoshClose commented on June 18, 2024

Yes. CsvHelper follows RFC 4180. It supports line ending of \r\n, \r, and \n.

from csvhelper.

tonidef avatar tonidef commented on June 18, 2024

@JoshClose , I'm finding my csv is treating carriage returns as new rows of data. Any suggestions on how to address this?

csv_carriage_return_issue

from csvhelper.

JoshClose avatar JoshClose commented on June 18, 2024

Are you saying CsvReader reading it improperly? Or CsvWriter is writing it improperly? Or something else?

from csvhelper.

tonidef avatar tonidef commented on June 18, 2024

I'm using CsvWriter with a StringWriter.

image

from csvhelper.

JoshClose avatar JoshClose commented on June 18, 2024

If you're opening it up in a text editor, the formatting is going to be as you'd expect. Take a look over RFC 4180; it's a short read. https://tools.ietf.org/html/rfc4180

If a field has a carriage return in it \r\n, then the field must be escaped by putting quotes around it "1\r\n2". The data you have is showing the field with the break has quotes around it.

Opening up in a text editor is going to format it as text, so the breaks will break. Try opening it up in Excel and you'll probably see it more as you're expecting.

from csvhelper.

tonidef avatar tonidef commented on June 18, 2024

I've found opening directly in Excel won't read special characters likes trademarks. I have to import the data and select a file origin for UTF-8. On import, it then reads the carriage returns as new lines. I can't determine a resolution to address both issues.

from csvhelper.

JoshClose avatar JoshClose commented on June 18, 2024

What is your goal? It looks like the data is being written correctly based on RFC 4180 (from what I can see). What needs to happen to the data after it's in CSV format?

from csvhelper.

tonidef avatar tonidef commented on June 18, 2024

It needs to be accessed in Excel, then is merged with other data by my user who then imports all the data into cvent...for seminar registrations.

from csvhelper.

JoshClose avatar JoshClose commented on June 18, 2024

It should open in Excel fine. You may have to set some options in Excel when opening or importing. You may need to specify a specific encoding too for all I know. Obviously, use the encoding that you used to write the CSV. CsvHelper doesn't do anything with encodings; it just uses the TextWriter you give it.

from csvhelper.

JoshClose avatar JoshClose commented on June 18, 2024

I'm not on a computer that I'm able to test anything out unfortunately. If you need some help, you can email me a sample text file, and I can give it a try with Excel tonight some time.

from csvhelper.

tonidef avatar tonidef commented on June 18, 2024

Thanks so much! Sending email now.

from csvhelper.

Related Issues (20)

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.