Questions tagged [invariantculture]

Gets the CultureInfo object that is culture-independent (invariant).

48 questions
2
votes
2 answers

.NET CultureInfo.InvariantCulture.CompareInfo IndexOf vs LastIndexOf - What is going on?

In our app I wanted to be good citizen and transfer from culture-aware string comparisons to some deterministic comparisons in InvariantCulture, but because of that my app started crashing with OutOfMemory because of infinite cycle. It all comes…
Jacob
  • 627
  • 6
  • 15
2
votes
1 answer

Changing culture of XamDataGrid cell values

I have a XamDataGrid with a column of floats, and I want these floats to be shown with InvariantCulture, i.e. with a point instead of a comma. How can I do that?
gartenriese
  • 4,131
  • 6
  • 36
  • 60
2
votes
1 answer

How to do a culture invariant conversion from int to String in Java?

For converting an integer to string in C# (with invariant culture), we do something like below: int num = 123; string numAsString = num.ToString(CultureInfo.InvariantCulture); Is there an equivalent of the above operation in Java or does…
bittusarkar
  • 6,247
  • 3
  • 30
  • 50
2
votes
0 answers

How does IIS determine error message language?

I am running an ASP.NET web site on IIS 7.5 with the culture and UI culture set to Invariant Culture in the settings. Client-based culture is set to false. The IIS server is running on a German Windows Server 2008 R2, my machine is running English…
Chris
  • 6,914
  • 5
  • 54
  • 80
2
votes
2 answers

Forcing DateTime.Parse to Fail for Invariant Dates

I'll be brief to start, then give details at the end. Consider the following code: CultureInfo cultureToTest = new CultureInfo("hu-HU"); Thread.CurrentThread.CurrentCulture = cultureToTest; DateTime testDateTime = new…
John Saunders
  • 160,644
  • 26
  • 247
  • 397
2
votes
1 answer

how can I format the axis in ms chart control

i'm using the ms chart control and would like to do the following: Format the Y axis of chartAreas[0] to a specific format. In this case it should be a number without decimals and grouped (per thousand) with a point. Tried it…
user369122
  • 792
  • 3
  • 13
  • 33
2
votes
1 answer

C# LINQ string.startsWith is not ignoring culture specific letters

I am a bit in a pickle. From all the documentation I read about StringComparison in .Net the InvariantCulture should select both "Kęstutis" and "Kestutis" when filter is "ke" .Where(fp => filter == null || (fp.RealName.StartsWith(filter,…
2
votes
2 answers

How to put strings into culture-invariant buckets?

My app needs to deal with strings that can contain accented characters. I need to be able to group those names into buckets for the different letters of the alphabet. I had originally thought of using CultureInvariant string comparison in .Net, but…
Philip Colmer
  • 1,426
  • 2
  • 17
  • 30
2
votes
2 answers

Posting date (dd/mm/yyyy) and float (comma) values to aspnet WebApi

The Problem When I post jSon data to webapi, using pt-br formats (dd/mm/yyyy for date and comma decimal separator for float), the values are deserialized as en-us formats resulting in error. i.e. » date: posting 23/01/2013 becames 01/01/0001 »…
1
vote
3 answers

How to change NumberDecimalSeparator to a dot in C# interpolated strings for non-english Windows

I have prepared a C# fiddle for my question, however it does not really show the actual problem and correctly uses dots as decimal separator in the interpolated double values (UPDATED with Tim's trick, thank you): using System; using…
Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
1
vote
1 answer

What is the right string comparison value to be used in a machine to machine communication scenario?

Consider a scenario where you are implementing code meant to be used for machine to machine communication. The typical example for that is the code executed inside a web API action method. Suppose that you want to perform an exact match between…
Enrico Massone
  • 6,464
  • 1
  • 28
  • 56
1
vote
0 answers

Forcing sqlite insert/update to use invariant culture for datetime

I'm using Thread.CurrentThread.CurrentCulture to display culture-sensitive data on the UI. It works well, as I just set it in one place and it affects entire application. The problem right now is when I'm saving the data to sqlite database, it's…
sponge
  • 31
  • 4
1
vote
1 answer

C# parsing to datetime regardless of culture info

I have problem parsing some date string where language is not english. The sample date string is "8 avril 2016 vendredi" which is "8 april 2016 friday" in english. I have tried this but no luck. DateTime dateTime; DateTime.TryParse("8 avril 2016…
Wylan Osorio
  • 1,136
  • 5
  • 19
  • 46
1
vote
2 answers

Deserialization decimal with invariant culture

Is it possible to deserialize decimal with invariant culture? I can do that with this pattern: [XmlIgnore] public decimal CurrencyValue { get; set; } [XmlAttribute("CurrencyValue")] public string CurrencyValueString { set {…
adamo94
  • 507
  • 1
  • 6
  • 15
1
vote
3 answers

Wrong DateTime parsing when using other cultures

I am using EF in a multi-language site to map results from SPs to objects. ctx.Database.SqlQuery("MySP {0}", Id).SingleOrDefault() I see that there is an issue with mapping dates when the culture changes. More specifically, I get the same…
user2173353
  • 4,316
  • 4
  • 47
  • 79