Upper/Lower Case Turkish Bug

I don’t know if this is a bug or not. I would thank some feedback before filing a bug case.

In Turkish they have two different “i”, one with dot and another without = i & ?
The same with capital letters: ? & I

Perhaps the problem is that our i (with dot) makes capital I (without dot).
Well the fact is that when I capitalize this text:

Dim t as string = "Ads?z Ba?ka de?i?iklik" MsgBox Uppercase(t)

I get

Obviously two different errors:

  • lower case i looses the dot when capitalizes
  • lower case ? does not capitalize.

Is this an error? If it is, is it a Xojo error or a system (Windows and OSX) error?

Thanks for your help

You may want to try with the next framework Text. It is probably more elaborate with that kind of support.

This works perfectly :

Dim t as text = "Ads?z Ba?ka de?i?iklik" dim TurkishLocale As New Xojo.Core.Locale("tr-TR") MsgBox t.uppercase(TurkishLocale)

So I don’t know if the issue with String is one of encoding or intrinsic limitation. Maybe filing a bug report would help clarify. In the meantime, you have enough with Text to use directly, or to build your own conversion method.

Thanks Michel,

Although it will take some time to modify my application, because it uses several languages, I see that this “Locale” solves this Turkish problem.
I don’t mind if it is Xojo’s or System’s fault with strings. If it can be solved with Text and Locale I’ll do it this way.

You can use a method that uses internally Text, but takes and returns String, so refactoring will be minimal :

[code]Public Function myUppercase(Txt as String) as String
Dim t as text = Txt.ToText
Dim result as string = t.uppercase(Xojo.Core.Locale.Current)

Return Result
End Function
[/code]

This will apply the default system locale, and return the proper uppercase on a Turkish system.

If you want to support Turkish on another system language, you will have to specify it.

Normally, string uppercase should use the default system locale.

In Turkish, uppercase i is ?. I tried to switch the system to Turkish and Ramon example has the same issue. That looks like a bug indeed.

String vs Text ISN’T JUST a “cosmetic” change as some seem to think
They do have behavioral differences - one works right in more circumstances than the other
You can guess which

[quote=287289:@Michel Bujardet]Normally, string uppercase should use the default system locale.

In Turkish, uppercase i is ?. I tried to switch the system to Turkish and Ramon example has the same issue. That looks like a bug indeed.[/quote]

Case conversion requires tailoring to work correctly for Turkish because there is no special encoding for a Turkish ‘i’. Case conversion can be somewhat complicated, so I’d recommend reading this ‘Notes on case conversion’ blog post.

String’s Uppercase function does not have a way to specify what locale it should be tailored for and always uses the default Unicode casing rules. Text’s Uppercase function was designed with these use cases in mind and works better with internationalization.

Thanks Joe.
Your points are clear enough for me. I don’t think I must file a bug about this thread.