Skip to content

String comparison, sorting and globalization use ICU instead of NLS in Windows 19H1+ #18423

Closed

Description

@safern

Globalization support change on Windows 10 19H1+

We changed the underlying library that we use in order to get localization data, perform string/char sorting and comparisons. If an application is running on Windows 19H1 or later which ships with ICU native library, we will use ICU as the library to perform this operations instead of Windows NLS APIs. If we fail to load/find ICU on the OS we will fallback and use NLS.

Version introduced

.NET 5.0 Preview4

Old behavior

Globalization behavior was mainly derived from Windows NLS native APIs.

New behavior

Globalization behavior will be mainly derived from ICU library shipped with Windows.

Reason for change

  1. Provide apps the same behavior in between different OSs (Linux, macOS, Windows).
  2. Allow apps control the globalization behavior by supporting having the apps use custom-built ICU library.

Recommended action

If customers want to fall back to use NLS, they can add a runtime switch in their runtimeconfig.template.json:

{
    "configProperties": {
        "System.Globalization.UseNls": true
    }
}

They can also set an environment variable:
DOTNET_SYSTEM_GLOBALIZATION_USENLS=true

Category

  • Core
  • Core .NET libraries
  • Globalization

Affected APIs


Issue metadata

  • Issue type: breaking-change

Activity

  1. added
    ⌚ Not Triaged
    breaking-change
    on May 13, 2020
  2. added and removed
    ⌚ Not Triaged
    on May 13, 2020
  3. tarekgh commented on May 14, 2020

    @tarekgh
    Member

    Thanks @safern. I am listing some change suggestion here:

    Maybe we need to change the title to something generic like "Globalization support change on Windows 10 19H1+"

    We used NLS APIs in all Windows SKUs.

    We may rephrase it as Globalization behavior was mainly derived from Windows NLS native APIs.

    We use ICU APIs when we're able to find it in the OS, if not we fallback to use NLS.

    We may rephrase it as Globalization behavior will be mainly derived from ICU library shipped with Windows. . Note I would avoid going to fallback details here as we are not expecting the fallback will really occur in normal cases.

    Provide apps the same behavior in between different OSs (Linux, Unix, Windows).

    did you mean to say OSX instead of Unix?

    Provide apps an option to control the localization data and version of ICU they use by building a custom ICU.

    maybe we can say Allow apps control the globalization behavior by supporting having the apps use custom-built ICU library.

    System.Char

    This one needs to be removed from the list. and we should remove all classes listed under Globalization namespace and just mention ` System.Globalization namespace classes'

  4. safern commented on May 15, 2020

    @safern
    MemberAuthor

    Thanks @tarekgh -- I've updated the issue with your recommendations.

  5. added a commit that references this issue on May 18, 2020
    4b8dd17
  6. added a commit that references this issue on May 19, 2020
    57ac4c9
  7. added
    🏁 Release: .NET 5
    on Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 5breaking-change

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions