[Lazarus] lclintf.OpenURL parameter: double quotes or not?

Bart bartjunk64 at gmail.com
Fri Apr 6 15:16:56 CEST 2012


On 4/6/12, Reinier Olislagers <reinierolislagers at gmail.com> wrote:
> Hi all,
> (Example on Windows)
> OpenURL can be used to open a file on the local machine.
>
> The documentation
> http://lazarus-ccr.sourceforge.net/docs/lcl/lclintf/openurl.html
>
> says you need to have a valid URL like file://c:\test\bla.pdf
>
> If I have a path with spaces in it and try and open a pdf file, these
> arguments work:
> "file://c:\some path with spaces\some file.pdf"
> and
> c:\some path with spaces\some file.pdf
>
> This one doesn't:
> file://c:\some path with spaces\some file.pdf
> (It doesn't open the file, but ShellExecuteW that is called in OpenURL
> does return a success result code)

When you use the file:// (or any other) URI scheme, maybe you have to
use HTML-escape codes for spaces (and some other characters):
file://c:/some%20file%20with%spaces%20in%20the%20filename.pdf

Bart




More information about the Lazarus mailing list