Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numberify doesn't work in all cultures #318

Closed
warappa opened this issue Aug 13, 2022 · 2 comments · Fixed by #319 or #320
Closed

Numberify doesn't work in all cultures #318

warappa opened this issue Aug 13, 2022 · 2 comments · Fixed by #319 or #320
Labels
bug Something isn't working

Comments

@warappa
Copy link
Contributor

warappa commented Aug 13, 2022

Environment

  • Commit: f18e645 (from 2022-08-12)
  • Nuget Package: -
  • Nuget Version: -
  • OS: Windows
  • .Net Target: All

Describe the bug
When converting a string to a number with Numberify(), floating point numbers are only parsed correctly if the current culture has a english-like number format. For eg. de-AT this isn't the case, so the input string 3.14 just returns the integer value 3 null, as , is the decimal separator.

To Reproduce

CultureInfo.CurrentCulture = new CultureInfo("de-AT");
var number = JsonValue.Create("3.14").Numberify();

Expected behavior
It should return correct floating point numbers regardless of current culture.

@warappa warappa added the bug Something isn't working label Aug 13, 2022
@gregsdennis
Copy link
Owner

gregsdennis commented Aug 13, 2022

Thanks for the report. I should be able to get to this soon.

Can you please fill out which package and version your using?

@warappa
Copy link
Contributor Author

warappa commented Aug 13, 2022

I have a small PR ready in a minute if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants