Comments (9)
Do you have a file that reproduces the issue?
from csvhelper.
Yes, how do i upload it?
from csvhelper.
Also, I have a workaround that appears to work. I'm reading the input into a string, normalizing the line endings to Windows format CRLF and then converting that back into a stream before passing it in to the CsvReader.
Code snippet i'm using:
string inputString = reader.ReadToEnd();
string normalizedLineEndings = Regex.Replace(inputString, @"\r\n|\n|\r", "\r\n");
from csvhelper.
Can you email me the file?
I have a feeling that using a Regex will slow down performance quite a bit.
from csvhelper.
If you change the check in the parser for '\n' to a '\r', your file works correctly. I can add an option for settings the line terminator with a default of '\n', and you could set it to '\r' if the file needs that.
Let me know if that solves the issue for you.
I will look into having it automatically figure it out also, but I haven't given any thought to if that's a good idea yet.
from csvhelper.
I put a new version up that allows you to choose what the line ending is. I tested with your file, and it should work fine if you just change the line ending to \r instead of the default \n.
from csvhelper.
Haven't tested yet, but my problem is that I don't know ahead of time which line ending the files will have (the file is uploaded by the user). So I can't hard-code the line terminator...
from csvhelper.
Ok, I will have to give that some thought. I think I should be able to do it fairly easily if I only worry about \r and \n line terminators.
from csvhelper.
RFC 4180 says that the file format has line endings of CRLF, so technically the CSV files you have aren't valid. I updated it so it will use either CRLF, CR, or LF for line endings. I removed the option of specifying the line ending.
from csvhelper.
Related Issues (20)
- ConfigurationException: 'Types that inherit IEnumerable cannot be auto mapped' when using custom class based on DynamicObject (NOT ExpandoObject) which also implements IDictionary HOT 3
- Missing "Product Version" in CsvHelper.dll HOT 1
- Column Name not displaying Using Mapping HOT 1
- Just thrown new exception by choice.
- Unexpected `InvalidCastException` in `TypeConverter<>` with nullable structs and value types HOT 2
- List<T>.ToAsyncEnumerable not accessible anymore after upgrade to CSVHelper 31.0.2 (.NET 8) HOT 5
- Set Custom Headers that derives from the property value. HOT 7
- Eliminate the columns if empty HOT 1
- Unregister ClassMap does not clear the previous maps if the same class is used HOT 2
- Getting problems with release build of my app using COM HOT 1
- add my report list columns' name as a header to the csv file when the HasHeaderRecord is set to false
- When Query from db and return IEnumable, will execute 2 times for sql query HOT 3
- Validate Header generate a very large message. HOT 2
- Header does not contain Quote, but some fields in row contain Quote, how should I read this kind of CSV HOT 4
- FastDynamicObject broke serialization HOT 7
- Using a ClassMap with custom type converter results in a "newed" object. HOT 1
- Using Custom TypeConverter causes dangerous/spurious CsvWriter behavior
- csv helper is writing 1 to 12 datetime in different format and 13 to 24 in different datetime format using version 4.0.30319 HOT 1
- FastDynamicObject ignores headers while used together with CsvWriter HOT 1
- Whitespace after delimiter can result in read error HOT 4
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 csvhelper.