← 输入框|github.com|刷新
Skip to content

localCompare not working with 'Umlaut' #7810

Closed

Description

@Bidou44

Environment
✔ Getting NativeScript components versions information...
⚠ Update available for component nativescript. Your current version is 5.4.2 and the latest available version is 6.1.0.
⚠ Update available for component tns-core-modules. Your current version is 5.2.0 and the latest available version is 6.1.1.
⚠ Update available for component tns-android. Your current version is 5.4.0 and the latest available version is 6.1.0.
⚠ Update available for component tns-ios. Your current version is 5.4.2 and the latest available version is 6.1.0.

Describe the bug
Using the localeCompare function to sort a list does not work with ¨ (the Umlaut german character). For example, the country Österreich appears at the end of my country list (so for example, after Vietnam)

To Reproduce
export class Country {
public name: string;
}

let countries: Array = ...;
countries = countries.sort((first, second) => {
return first.name == null ? -1 : first.name.localeCompare(second.name, 'de');
});

Expected behavior
Österreich should be for example between Norway and Poland and not at the end of the country list.

Sample project

Additional context
For countries without ¨ (Umlaut) it works as expected.

Activity

  1. self-assigned this
    on Sep 12, 2019
  2. tsonevn commented on Sep 12, 2019

    @tsonevn
    Contributor

    Hi @Bidou44,
    The implementation of the localeCompare comes from V8 for Android and Apple's JavaScriptCore for iOS. On that matter, this behaviour does not seem to be caused by NativeScript core modules. I found this thread in the V8 forum, where a similar case is discussed.

  3. Bidou44 commented on Sep 12, 2019

    @Bidou44
    Author

    Ok thank you for that quick response.
    Will close this issue since it seems to not be related to nativescript....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions