runtime: ToUpper not working as intended with Turkish Culture
Description
In our tests ToUpper() method returns false characters. The lowercase “i” character should be “İ” but we are getting “I” only in .NET MAUI apps. Other project types are working fine.
Steps to Reproduce
- Create a new .NET MAUI project (.Net 6 or preview both are same)
- We have added CodePages nuget (System.Text.Encoding.CodePages)
- Add the following code at MauiProgram.cs
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); // don't know if this helps, just tried...
CultureInfo tr = new CultureInfo("tr-TR", false);
string test = "i";
var test2 = test.ToUpper(tr);
var testResult = test2 == "İ"; // result is false because test2 is "I" instead of "İ"
Link to public reproduction project repository
https://github.com/sencagri/MauiAppToUpper
Version with bug
7.0 Release Candidate 2
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
All android versions
Did you find any workaround?
No response
Relevant log output
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 24 (18 by maintainers)
@sencagri just fyi, upper and lower casing strings have nothing to do with the Encoding.
doing
is not needed anyway.
Windows works fine
Reproduced this on Android; tried it on a Windows MAUI project and it works fine.