Findfirst Unicode issue lazarus / 21-General ---------------------------------------------------------------------- Redenegue · 2021-11-12 00:51 Everything was fine, until my computer died. I was running win7 64 and some version of Lazaurus. Now I have Win 7 64 again, probably with different updates. Lazaurus is 2.2.ORC1 FPC 3.2.2 Since this posting, I have tried other versions. None work. I also tried versions under virtual box with an earlier version of Win 7. I had no problem until now. Now FindFirst returns garbage for foreign characters. I have searched and searched for an answer. Tried changing settings to no avail. I do not care about compatibility. I just want to get the file names correct. Can someone help me? This is also a problem with TShellTreeView and TShellList view. They will not handle foreign letters either. Seems to me that this is a big issue with Lazarus. There must be a lot of others with this issue. ---------------------------------------------------------------------- trev · 2021-11-12 01:46 Try FileUtil.FindFirstUTF8 ? ---------------------------------------------------------------------- Redenegue · 2021-11-12 08:00 Sorry, it does not help. Also, it would not help with the files names retrieved by TShellTreeView or TShellList view. It it returns a foreign name, it crashes when trying to use it for a path. It seems that this issue is related to Lazarus wanting to be usable in all environments, but, if it does not work, why bother? I see a lot of discussion on this, but if there is an answer out there, it is buried in a lot of useless round about talk. I really do not understand what is going on. My previous compiled programs work fine. Now, nothing works, and if FindFile does not work, I don't even have a work around. I literally have years of work that will not run. ---------------------------------------------------------------------- JuhaManninen · 2021-11-12 08:14 What was your Lazarus version when it worked? UTF-8 is used internally and it works cross-platform without any extra effort. ---------------------------------------------------------------------- wp · 2021-11-12 09:38 Trying to verify your observations (which are hard to believe in general) I wrote the attached program. It does a FindFirst/FindNext for the current folder and puts the found file names into a Listbox. To get filenames with foreign characters I added some empty files and a folder named as words of "Lorem ipsum" in Greek and Chinese (e.g. https://generator.lorem-ipsum.info/_greek). Running this program lists all files in the listbox correctly, including the ones with foreign characters. There is no crash. This was done on Win 11 and Win 7. I did not test ShellListBox/ShellTreeView since they do nothing else internally. So, the issue must be in your installation. Since you wrote that you also tested other Lazarus versions which do not work either, I suspect that the issue must be in your system. The usual candidate to cause unexpected bad behaviour of Lazarus programs is the virus scanner. These programs have become very aggressive towards "unknown" programs nowadays. Which virus scanner are you using? I used to have BitDefender for some time, but after it deleted my entire FPC toolchain after an update I switched back to Windows Defender which is working fine. But even with it I had to put the Lazarus folder and my project folders into a white-list. ---------------------------------------------------------------------- Redenegue · 2021-11-12 13:19 I ran your program and it worked. I deleted every thing around my "Add" function. It gives the correct name now. This code all worked ok before. Now, it is getting an error with the indexing and filesize. TShells are working too. Turns out that the error was farther down the road than I thought. I was fooled since it did work before. Now that I located the new issues, I think I can handle it. You helped set me on the right path. Maybe I should have caught this myself. I have some old age health issues. Thanks for listening anyhow. ---------------------------------------------------------------------- wp · 2021-11-12 14:38 Nice that I could help. Quote from: Redenegue on November 12, 2021, 02:19:43 pmMaybe I should have caught this myself. I have some old age health issues. Thanks for listening anyhow. That's why I always recommend reporters to reproduce an issue by creating a small and simple demonstration project separate from the main project. Having to start a-new, helps the user to get rid of the complexity of the main project and forces him to focus on the issue reported. And when he finds out that the issue does not exist in this small program he opens himself to find the bug somewhere else - just like her.