-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Description
Some SqlString
APIs are relying on LCID numbers to represent users' cultures, e.g.,
public SqlString(string? data) : this(data, System.Globalization.CultureInfo.CurrentCulture.LCID, s_iDefaultFlag) |
This can cause issues when user's culture is not part of https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/Globalization/IcuLocaleData.cs (e.g., en-CZ
), causing the returned LCID to be 0x1000 (LOCALE_CUSTOM_UNSPECIFIED
), that is not acceptable by some CultureInfo
APIs, e.g.,
runtime/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs
Line 993 in 94c356d
public static CultureInfo GetCultureInfo(int culture) |
The use of LCID is not recommended:
Note that LCIDs are being deprecated, and implementers are strongly encouraged to use newer versions of APIs that support BCP 47 locale names instead. Each LCID can be represented by a BCP 47 locale name, but the reverse is not true. The LCID range is restricted and unable to uniquely identify all the possible combinations of language and region.
https://learn.microsoft.com/en-us/globalization/locale/other-locale-names#lcid and the use of culture names is preferred.
cc: @tarekgh