Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace all toUpperCase() and toLowerCase() calls with toUpperCase(Locale.ENGLISH) to avoid undefined behavior #169

Closed
mkrupczak3 opened this issue Sep 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mkrupczak3
Copy link
Member

mkrupczak3 commented Sep 12, 2024

Certain locales (such as Türkiye) perform toUpperCase() and toLowerCase() in a way that is non-intuitive and inconsistent with English speaking locales. For example, lowercase i is converted to İ (with dot) instead of I (without dot) as expected.

This may cause certain String matching functions critical to control flow for OpenAthena to fail (e.g. drone make/model matching).

To avoid undefined behavior when OpenAthena Android is run on mobile devices internationally, all toUpperCase() and toLowerCase() calls should be performed with Local.ENGLISH instead of the default. Android already does this for their equivalent toUpperCase() function in Kotlin.

More info:
https://stackoverflow.com/questions/10336730/which-locale-should-i-specify-when-i-call-stringtolowercase

@mkrupczak3 mkrupczak3 added the bug Something isn't working label Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant