Seaching a text in a TextArea

I type in a TextField Fantôme to search its occurences in text from a TextArea.
It found nothing.

But, when I Copy that same text from the TextArea and Paste it in the TextField, I get n occurences…

I thing I will eat my hat… or walk on my head🇺🇦

Could there be a stray character that would be invisible in the TextArea and that you do not type in the TextField ?

I would use a hex editor and copy from the TextField and then from the TextArea to compare both string. Maybe you will see what’s different.

No gremlin in the TextArea.

The text from the TextField comes from the Keyboard.

The text from the TextArea comes from file names. These file names were typed using… the Keyboard (all in the same machine).

Conclusion: there cannot be any difference between them.

The answer is… to be found in the Unicode representation of the diacritical vowel, in this case ô (ô & ocirc ;).

This is bad “progress”…

How do you search ?

That’s a good question. I will give the answer later, after the morning usual readings (mail, news, etc.).

The search line is:

Search_Loc = InStr(Start_Loc, Source_Str, Search_Str)

Any accented characters ?

Haven’t we had this same exact conversation multiple times now? Composed vs. Decomposed characters. MacOS filenames are one, text typed in a textarea are the other. You have to normalize them before you compare.

In a way, yes.

The trouble is… all the characters comes from the keyboard / same computer. That is what is bothering me.

I do not recall that. How can we do that ?

Tout ce que je peux taper au clavier…

They do, but they don’t. The OS interprets/stores them one way as a filename. A textfield interprets/stores them differently. MBS has a simple way to normalize them, and there have been several discussions of how to do this.


If there are any accented characters, then Instr() may not recognize them if for some reason they are decomposed.

I am decomposed.

Aren’t Unicode created to avoid all these troubles ?

Joe Newbie would say that é = é, and i <> e !

à quoi ça sert que ducros se décarcasse ?

I will write a book I will name it “Easy Unicode” in 256 volumes !

PS: don’t shoot the horse, it is already dead.

The way to reconcile decomposed and composed is to use the Text format.

Something like

var myText as Text = TextArea1.Text
var TAContent as string = myText.Tostring

myText = SearchField.Text
var SearchString as string = mytext.tostring

Instr(TAContent, SearchString)