Recent

Author Topic: [SOLVED] TOpenDialog and files containing single quotes  (Read 2104 times)

oneeyed

  • Newbie
  • Posts: 5
[SOLVED] TOpenDialog and files containing single quotes
« on: August 25, 2014, 08:02:10 am »
Hello,

I have a problem with the TOpenDialog on windows.
I am using the latest Lazarus (1.2.4).

When using

Code: [Select]
For I:= 0 to (OpenDialog1.Files.Count-1) do
    begin
    if not FileExists(OpendDialog1.FilesDialog.Files[I]) then ShowMessage(OpendDialog1.FilesDialog.Files[I]+' doesn''t exist.');
    end;

FileExists returns false when the file does exist but contains a single quote : '

« Last Edit: August 25, 2014, 09:48:52 am by oneeyed »

bigeno

  • Sr. Member
  • ****
  • Posts: 266
Re: TOpenDialog and files containing single quotes
« Reply #1 on: August 25, 2014, 08:26:42 am »
Try with FileExistsUTF8 from lazutf8 http://wiki.freepascal.org/LCL_Unicode_Support

Bart

  • Hero Member
  • *****
  • Posts: 5706
    • Bart en Mariska's Webstek
Re: TOpenDialog and files containing single quotes
« Reply #2 on: August 25, 2014, 08:36:41 am »
Does the filename (Files
  • ) returned by TOpenDialog actually contain the single quote?


Bart

oneeyed

  • Newbie
  • Posts: 5
Re: TOpenDialog and files containing single quotes
« Reply #3 on: August 25, 2014, 09:45:48 am »
Thanks beigeno, FileExistsUTF8 does work. I should have expected that it was a unicode problem in my code.

 

TinyPortal © 2005-2018