alwaysbusy Expert Licensed User Longtime User Nov 5, 2024 #1 Searching for a bug in my BANano library, I discovered a bug in the .toLowerCase() for the letter I in the Turkish language. In the Turkish locale, the Unicode LATIN CAPITAL LETTER I becomes a LATIN SMALL LETTER DOTLESS I. That’s not a lowercase “i”. To test: Code: Copy #VirtualMachineArgs: -Duser.language=tr Code: Copy Dim s As String = "IF" If s.toLowerCase = "if" Then ' the s.toLowerCase returns ıf (no dot on the i) Log("True") Else Log("False") End If Result: returns False Possible solution, being able to add a Locale: Code: Copy .toLowerCase2(Locale.ROOT) Edit: the same goes for .toUpperCase() Alwaysbusy Last edited: Nov 6, 2024
Searching for a bug in my BANano library, I discovered a bug in the .toLowerCase() for the letter I in the Turkish language. In the Turkish locale, the Unicode LATIN CAPITAL LETTER I becomes a LATIN SMALL LETTER DOTLESS I. That’s not a lowercase “i”. To test: Code: Copy #VirtualMachineArgs: -Duser.language=tr Code: Copy Dim s As String = "IF" If s.toLowerCase = "if" Then ' the s.toLowerCase returns ıf (no dot on the i) Log("True") Else Log("False") End If Result: returns False Possible solution, being able to add a Locale: Code: Copy .toLowerCase2(Locale.ROOT) Edit: the same goes for .toUpperCase() Alwaysbusy
Erel B4X founder Staff member Licensed User Longtime User Nov 6, 2024 #2 Have you encountered it without explicitly setting user.language=tr?
alwaysbusy Expert Licensed User Longtime User Nov 6, 2024 #3 yes, it happens on every Windows where the language is set to Turkish. This setting is just to emulate it on a non Turkish windows. It appears to be a known problem: https://garygregory.wordpress.com/2015/11/03/java-lowercase-conversion-turkey/
yes, it happens on every Windows where the language is set to Turkish. This setting is just to emulate it on a non Turkish windows. It appears to be a known problem: https://garygregory.wordpress.com/2015/11/03/java-lowercase-conversion-turkey/
Erel B4X founder Staff member Licensed User Longtime User Nov 6, 2024 #4 You can call this method when the app starts to set the default locale to US. Code: Copy Private Sub SetDefaultLocaleToUS Dim jo As JavaObject jo.InitializeStatic("java.util.Locale").RunMethod("setDefault", Array(jo.GetField("US"))) End Sub If you want to keep using the native locale for date related methods then set the date format before calling this method.
You can call this method when the app starts to set the default locale to US. Code: Copy Private Sub SetDefaultLocaleToUS Dim jo As JavaObject jo.InitializeStatic("java.util.Locale").RunMethod("setDefault", Array(jo.GetField("US"))) End Sub If you want to keep using the native locale for date related methods then set the date format before calling this method.
alwaysbusy Expert Licensed User Longtime User Nov 6, 2024 #5 Yes, that is also the sort of workaround I use now. But on the long run, I believe this should be resolved within the B4J language (especially since Java has a solution for it with its locale parameter). Those are errors one can spend a lot of time on: in my case I lost more than 2 days on it.
Yes, that is also the sort of workaround I use now. But on the long run, I believe this should be resolved within the B4J language (especially since Java has a solution for it with its locale parameter). Those are errors one can spend a lot of time on: in my case I lost more than 2 days on it.
Erel B4X founder Staff member Licensed User Longtime User Nov 7, 2024 #6 I agree. It will be fixed. Note that the framework does handle lower casing correctly. There is a technical issue related to the way the string methods are implemented which makes it more difficult to automatically set the locale.
I agree. It will be fixed. Note that the framework does handle lower casing correctly. There is a technical issue related to the way the string methods are implemented which makes it more difficult to automatically set the locale.
Erel B4X founder Staff member Licensed User Longtime User Jan 11, 2026 #7 This is fixed for the next update.