UPPERCASE is (sometimes) not working Huge issue

After a very long investigation, I have found a really ugly bug.
In recent months, I have received bug reports from customers that a certain feature was not working correctly.
Also read this:

I use uppercase to check if there are lowercase chars in a string.

var t as string = “Aef6V”
if StrComp( t , Uppercase(t) , 0) = 0 then
msbox "Does not contain lowercase chars"
else
msgbox "Does contain lowercase chars"
end

I could not reproduce this, which of course makes it difficult to find a bug and fix it.
After a lot of mails and phone calls, I found that only Chinese customers had the problem.
So I thought somewhere there was a problem with encoding strings. Well, that turned out not to be the problem.

However, after some more testing and cooperation with the Chinese customers, the error came to light. UPPERCASE does not work for the Chinese customers.

So this code gives an wrong result only for Chinese users.

Var x as string = "aabbBBcCdD".
Msgbox uppercase(x)

As expected, this returns a message box with “AABBBBCCDD”.
But for Chinese users, this returns “aabbBBcCdD” … WTF?

Anyone have an idea how this can happen? Admit … this can cause a lot of frustration when your program doesn’t work for some customers.

Addition:
As far as I know, this is only with Chinese users. Maybe there are others …

Kem did provide a solution using RegEx
Which I did use in another program - but not in the one I had issues. :slight_smile:

var rx as new RegEx
rx.SearchPattern = "\p{Ll}"
if rx.Search( token ) isa RegExMatch then
  // has lowercase
end if

Maybe a bug related to CJK locales. Languages that does NOT have such thing of upper/lower case, just ideograms. Needs Xojo investigation.

Well, that not bad thinking Rick!
Never thought about that.

There are some string issues on Asian language systems: feedback://showreport?report_id=54638 no idea if this is the same issue or something else?

What is the encoding of your string?

See String.Left fails with nil encoding on a Korean-language macOS system - #12 by Mike_D

Encoding is UTF8

Imo, this is an important bug that needs some attention.

I recently had some fun with “Thunderbird” vs. “thunderbird” on APFS which is really odd because APFS isn’t exactly new.

You didn’t say which OS your users are using. If you are doing macOS did you try NSStringCompareMBS instead of StrComp?

macOS and compiled with the latest Xojo version.

For now, I have a solution that Kem provided using Regex.

What is your Feedback case number?

And have yoy tried it with string.Compare rather than strcomp?

Tried string.compare and its the same problem.

Anyhow, I have a solution with RegEx now.
But surely Xojo Inc should take a look at it, when they have some time left.

What is your Feedback case number?

1 Like

I do not have Feedback installed (I gave up adding bug reports). :-/
And yes, I know they won’t fix it without a feedback case. But I already have a solution now (RegEx)

I don’t expect it being fixed any time this way.