Coder Social home page Coder Social logo

Comments (5)

vcaraulean avatar vcaraulean commented on June 9, 2024

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.

JoshClose avatar JoshClose commented on June 9, 2024

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.

vcaraulean avatar vcaraulean commented on June 9, 2024

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.

JoshClose avatar JoshClose commented on June 9, 2024

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.

vcaraulean avatar vcaraulean commented on June 9, 2024

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)

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.