Comments (5)
If I revert the changes in CsvReader.cs line 412 then all tests are green on my PC.
Is there any particular issue why you're forcing conversion being do in Invariant Culture?
from csvhelper.
Hmm... That might be an issue with the test itself. Meaning, it's using DateTime.Now.ToString() in your culture, and then trying to convert it using invariant culture. Since invariant is a form of english, it must just work for me. I can fix the test. Is that the only test that has issues?
This brings up a good point though. I think there should probably be a configuration setting for culture that defaults to invariant. So if the user is in a different culture and is reading text that's in their culture, they can explicitly set the culture, and it will convert it correctly. Same with writing.
from csvhelper.
Yes, fixing the test is an easy move, just set the current thread's culture
to invariant. And that was only one test failing...
If you have seen or heard about people having need to configure it then
having a configurable option would be nice. If you go that
route, the default value (local or invariant) should be carefully
considered. In my opinion the local should be the default one. If I'm doing
a simple DateTime.Now.ToString() without specifying in my code the culture
why should I say to CsvHelper to use a specific culture when parsing a
value?
For me, if I change in both places ConvertFromInvariantString to
ConvertFromString all tests are green without any explicit Culture
manipulation.
That's why I've been asking why have you changed converter to use
ConvertFromInvariantString? Any specific reasoning?
On Mon, Jul 25, 2011 at 9:21 PM, JoshClose <
[email protected]>wrote:
Hmm... That might be an issue with the test itself. Meaning, it's using
DateTime.Now.ToString() in your culture, and then trying to convert it using
invariant culture. Since invariant is a form of english, it must just work
for me. I can fix the test. Is that the only test that has issues?This brings up a good point though. I think there should probably be a
configuration setting for culture that defaults to invariant. So if the user
is in a different culture and is reading text that's in their culture, they
can explicitly set the culting, and it will convert it correctly. Same with
writing.Reply to this email directly or view it on GitHub:
#16 (comment)
from csvhelper.
The reason it's there is because of a suggestion from someone. I haven't done much with culture before and hadn't even really thought about it. Now there are many people with a different culture than mine, so I need to account for this better. I will need to put some unit tests in to make sure that it works across cultures. The reason it's there is pretty much because of a lack of understanding of cultures.
I think your suggestion of using the local culture by default is correct and I will put in that config.
from csvhelper.
Until proper configuration is done should I change code back to
ConvertFromString in CsvReader?
I have another commit ready for a pull request, they can go together...
On Tue, Jul 26, 2011 at 4:07 PM, JoshClose <
[email protected]>wrote:
The reason it's there is because of a suggestion from someone. I haven't
done much with culture before and hadn't even really thought about it. Now
there are many people with a different culture than mine, so I need to
account for this better. I will need to put some unit tests in to make sure
that it works across cultures. The reason it's there is pretty much because
of a lack of understanding of cultures.I think your suggestion of using the local culture by default is correct
and I will put in that config.Reply to this email directly or view it on GitHub:
#16 (comment)
from csvhelper.
Related Issues (20)
- 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
- Microsoft.Bcl.AsyncInterfaces dependency issue HOT 3
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.