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

fix(android): uppercase conversion in getEnumName() method #3311

Merged
merged 4 commits into from
Jan 12, 2024

Conversation

krystofcelba
Copy link
Contributor

Description

Fixed a bug affecting locales such as
Turkish, where lowercase 'i' was incorrectly converted to 'İ' instead of 'I'. Now, the US locale is explicitly used for enum name conversion to ensure correct character mapping.

Fixes #3255

Checklist

  • I've read CONTRIBUTING.md
  • I updated the doc/other generated code with running yarn generate in the root folder
  • I have tested the new feature on /example app.
    • In V11 mode/ios
    • In New Architecture mode/ios
    • In V11 mode/android
    • In New Architecture mode/android
  • I added/updated a sample - if a new feature was implemented (/example)

Fixed a bug affecting locales such as
Turkish, where lowercase 'i' was incorrectly converted to 'İ'
instead of 'I'. Now, the US locale is explicitly used
for enum name conversion to ensure correct character mapping.
@krystofcelba krystofcelba changed the title fix: uppercase conversion in getEnumName() method fix(android): uppercase conversion in getEnumName() method Jan 10, 2024
@mfazekas
Copy link
Contributor

Amazing! Thanks much!

@krystofcelba
Copy link
Contributor Author

@mfazekas, could you please provide an estimated timeline for when you expect the merge to be completed?

@@ -40,7 +40,7 @@ class RNMBXStyleValue(config: ReadableMap) {
}

fun getEnumName(): String {
return mPayload!!.getString("value")!!.toUpperCase().replace("-", "_")
return mPayload!!.getString("value")!!.uppercase(Locale.US).replace("-", "_")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ‘uppercase()’ without locale param should work.

https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/uppercase.html

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right :). If you don't mind I have set up Kotlin unit testing in the project, I have added a unit test for that to be sure.

@mfazekas
Copy link
Contributor

@mfazekas, could you please provide an estimated timeline for when you expect the merge to be completed?

Let a note on the change, then it can be merged

@mfazekas mfazekas merged commit 945bdcd into rnmapbox:main Jan 12, 2024
10 checks passed
@Buthrakaur
Copy link
Contributor

Hi @mfazekas , when do you plan to create a release with this fix, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: IllegalArgumentException java.lang.Enum in valueOf
3 participants