[SOLVED]Problem with accented characters in folder name lazarus / 35-Windows CE ---------------------------------------------------------------------- rocka1 · 2012-07-16 11:26 When trying to run an application on Windows Mobile, I have to confirm where's the data file, I also have to load it later and so I have to indicate the path ... When creating the application in the emulator I do the tests in English version of WinMobile, when tested with a mobile version in Portuguese, "kaput!" I did some tests, like: Code: [Select]Showmessage(ExtractFilePath (Application.ExeName)); Gives error, the application is in Storage Card ("Cartão de Memória" in  portuguese), and the result is: \Cart?o de Mem?ria\Test12\.... And then, of course, this also fails: Code: [Select]if FileExists(ExtractFilePath(Application.ExeName)+'test.db') then And so on ... Code: [Select]Mypath:=ExtractFilePath(Application.ExeName)+'test.db'; It's clear that the problem is due to the accented characters. If someone runs the application on portuguese WinMobile and put the app in the Storage Card, the app will never work ... Someone with a solution for these cases? Thank you ---------------------------------------------------------------------- User137 · 2012-07-16 15:16 This should work though? Code: [Select]if FileExists('test.db') then At some point i stopped putting full path on anything in Lazarus projects. I haven't had any issues with it, it's like guaranteed to be in executable folder always. Also, there are FileExistsUTF8 and other UTF8 there for accented characters. ---------------------------------------------------------------------- rocka1 · 2012-07-16 15:42 Quote from: User137 on July 16, 2012, 05:16:37 pmThis should work though? Code: [Select]if FileExists('test.db') then At some point i stopped putting full path on anything in Lazarus projects. I haven't had any issues with it, it's like guaranteed to be in executable folder always. Also, there are FileExistsUTF8 and other UTF8 there for accented characters. Unfortunately works on win32, but in wince without giving full path does not work. ---------------------------------------------------------------------- rocka1 · 2012-07-18 01:34 Well, I was wrong, I found that the problem was further ahead, not in Fileexists and the full path, but in SQLite3Connection1, where I have to give the full path ... I think I have a "smart" solution, not a beautiful code, but i think will work Cannot test right now on a real Pda, my and the emulator are in English Tested with a subfolder named " Cartão de Memória" in the emulator Something like this : Code: [Select]var   bu:TSQLite3Backup;   File1:AnsiString;  Begin Edit2.Text:=ExtractFilePath(Application.ExeName); if pos('Cart?o de Mem?ria',Edit2.Text)>0 then Edit2.Text:= AnsiReplaceStr(Edit2.Text,'Cart?o de Mem?ria','Cartão de Memória');  ... ... bu.Restore(Edit2.Text+'test.db',SQLite3Connection1); ..... ..... end; Edit2.text is hidden. Strange, if I replace edit2.text by "File1" , declared in var,  it doesn't work, only with the text in the Tedit .. ---------------------------------------------------------------------- felipemdc · 2012-07-18 11:59 It is a caracteristic of the platform. Pathes always need to be complete in WinCE. ---------------------------------------------------------------------- ezlage · 2012-07-18 12:22 I remember of a problem like this, I solved by changing the CharSet property of the DataSet at run-time and using the DataSet to get the path (FilePathFull or FilePath). It worked, but I just had bypassed the issue. Regards. ---------------------------------------------------------------------- rocka1 · 2012-07-18 14:18 I found this code, ... This trick can be very usefull, If anyone want to convert to pascal ... From : http://www.codeproject.com/Articles/161388/Windows-Mobile-Programming- Tricks-on-the-NET-Compa QuoteGet the names of all storage cards Some devices may have several storage cards installed in them. What's even more important is that the storage cards don't necessarily have to be named \Storage Card. To iterate through all storage cards, we don't even need to use any Platform Invokes. The trick is to find all folders which have the Temporary attribute set. The code is very simple: Code: [Select]static public List GetStorageCardNames() {     DirectoryInfo rootInfo = new DirectoryInfo("\\");     List paths = new List();     foreach (DirectoryInfo dirInfo in rootInfo.GetDirectories())     {         if ((dirInfo.Attributes & FileAttributes.Temporary) != 0)         {             //Debug.WriteLine("Directory Name: " + dirInfo.Name)             //Debug.WriteLine("     Full Name: " + dirInfo.FullName)             paths.Add(dirInfo.FullName);         }     }     return paths; } ---------------------------------------------------------------------- rocka1 · 2012-07-21 20:04 Done : AnsiToUtf8(ExtractFilePath(Application.ExeName) Now, instead of "Cart?o de mem?ria" the result is : "Cartão de memória"