On locales and locale-specific behavior of formatting functions #560
Labels
area:cil-interop
Related to CIL (.NET) interop
area:infrastructure
Repository infrastructure: build, test scripts etc.
area:standard-support
Related to the C standard support
kind:feature
New feature or request
status:help-wanted
Open for contributors
My general idea on locales in Cesium was the following:
CultureInfo
.Note that I would really like to just drop this all into the trash bin and use the invariant culture universally. However, keeping in mind the C standard and programs written for alternative C implementations, I think that the best decision for the Cesium users is to make this user-controllable. That is, give the users the C API for locales.
@BadRyuner comments on the current behavior in #559: there are problems in our own tests that now implicitly rely on this locale stuff, and the locale treatment varies between implementations. In particular, Microsoft's C implementation doesn't seem to agree with… uhm, the Microsoft's .NET implementation on what decimal separator to use?
It's more or less easy to fix the tests by setting
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
when running them, but I no longer believe that the current's Cesium behavior is acceptable.First of all, let me quote paragraph 2 from section 7.1.1 Definition of terms of the C standard we use:
So, we are right in that
printf
should consult to locale.But then, let's also go to 7.11.1.1 The
setlocale
function and read paragraph 4:This means that every Cesium program that adheres the C standard should have an equivalent of the default "C" locale set on by default. I believe that one is most commonly associated with the culture-invariant environment in other C implementations; for now I didn't look it up in the standard, but that's the common practice, so let's stick with that for now.
So, should we just do something like
CultureInfo.CurrentCulture = InvariantCulture
in themain
function by default? I think we should.The text was updated successfully, but these errors were encountered: