The Open button use the TextInputStream first code snippet:
Var f As FolderItem = FolderItem.ShowOpenFileDialog("text") // as defined in File Type Sets Editor
If f <> Nil Then
If f.Exists Then
// Be aware that TextInputStream.Open could raise an exception
Var t As TextInputStream
Try
t = TextInputStream.Open(f)
t.Encoding = Encodings.UTF8
TA.Text = t.ReadAll
Catch e As IOException
MessageBox("Error accessing file.")
End Try
t.Close
End If
End If
The Search button:
Var Search As String = DefineEncoding(TF_Search.Text, Encodings.UTF8)
If InStrB(TA.Text, TF_Search.Text) > 0 Then
MsgBox "InStrB() found it !"
End If
If InStrB(TA.Text, TF_Search.Text) > 0 Then
MsgBox "InStr() found it !"
End If
That was the idea. A car must have made noise when I was typing the code…
I modified the code, but same result.
The idea was to be sure I get that with the same encoding.
The text file was created in the same computer once I finished to type the code (when I needed it). I copied folder names from the Finder and pasted that in TextEdit, the n save to disk. No fancy stuff have been done. Just what I wrote above.
The hard disk where the folders resides is usually connected to an old Intel i5 / El Capitan computer.
You mean storing the text from the file into a string and search that string ? It’s an idea.
No, It change nothing.
There is a bug here, one we saw some days ago. I wanted to know, while I have an M1, etc. if this is also the case there.
What I do not understand yet, is why I never saw it before. Copy / Paste file names from the Finder into a Xojo application is something I do everyday since… I cannot remember.
I even added a feature for when I run Windows to get the file names from windows because it is not possible to do that with Select All Items / Copy / Paste with the Explorer (until last year).
? If you meant Xojo 2021 beta… no way. My license expired years ago.
You may have skipped the source of the data n the text file: files names copied from the Finder and pasted in TextEdit, then saved as .txt (check my project). Typing text works fine. As well as Copy the search text from the loaded data.
Hard to follow… that is why I wanted to share the project wth the text file; but I do not had name/password to upload my zip.
That is why I set the Encoding to UTF8 n both cases, use the most recent software / hardware.
For source = empty: I do not recall (probably bad testing here… I needed my coffee ?), but setting the Read Position to 0 (or 1) before the second Read will solve that.
Now, I got days ago a problem with a character at sort time: standard space (32) and non breaking space (160): looks similar, have the same amount of bytes (1) and tooks time until I realize that is the other space.
What I do not discover is how I could have placed a nbsp character (Option-Space in my French Keyboard) in file names (located in the first 15 or so characters of the file name…).
I am quite sure you can get the probem with your German OS.
I do not know about Windows, sorry.
Remember:
I do not typed anything on purpose to get troubles ;). I only typed text to name files; these names holds what you called composite character, but they came from my keyboard. So, if you create a Folder you call it “Aldi-Süed.de“, then read its name and compare t vs “Adi-Nord.de” you will fall into troubles.
And this is certainly the case for nearly each and every European names “España” for Spanish, etc. for Italian, Dutch, Dannish, Svedish, …
i had customer calls and search them in database and not found them because variant spelling.
what i heard was written with other notation. ups. both in name and street^^
or i forgot to clear other filters…
ei = ay
i = ie
ä = ae
…
i think the only way to find it is a multiple search. or a replace before.