-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Description
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");