Skip to content

Locale/language-sensitive case mapping ("Whats wrong with Turkey?") #72966

@ozgur-yalcin

Description

@ozgur-yalcin

Whats wrong with turkey ?
Please test the code below after reading the above blog.

assert_eq!("istanbul".to_uppercase(), "ISTANBUL");

Is it OK ? It will work fine, right ?
Don't be so sure!
If you care a whit about localization or internationalization, force your code to run under the Turkish locale as soon as reasonably possible.

Please add support localized case folding to Rust like other programming languages below:

JS case folding
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase

GO case folding
https://golang.org/pkg/strings/#ToLowerSpecial
https://golang.org/pkg/strings/#ToUpperSpecial

JAVA localized case folding
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#toLowerCase(java.util.Locale)
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#toUpperCase(java.util.Locale)

.NET localized case folding
https://docs.microsoft.com/en-US/dotnet/api/system.string.tolower
https://docs.microsoft.com/en-US/dotnet/api/system.string.toupper

When it is supported, the code below should works like a charm !

assert_eq!("istanbul".to_uppercase("tr-TR"), "İSTANBUL");

or with a new function

assert_eq!("istanbul".to_localeuppercase("tr-TR"), "İSTANBUL");

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UnicodeArea: UnicodeC-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions