URL Syntax and RevBrowser on Mac

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
Simon Knight
Posts: 425
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

URL Syntax and RevBrowser on Mac

Post by Simon Knight » Fri Jan 20, 2017 4:37 pm

I have a utility application that displays PDF files in a revbrowser window. The name of the file is passed to the browser as a URL. If the name passed contains either a space or a pipe then the browser fails to locate the file and displays a blank page. The solution is to replace the special characters with their hex values using the lines below

Code: Select all

replace " " with "%20" in tMyFilePath
  replace "|" with "%7C" in tMyFilePath
There may be other characters that may be used in Finder file names that will also cause a fail.

I had a look in the dictionary and read about the URLEncode command. This appears to remove the need for a list of special characters but unfortunately it does not seem to work. The example filename contains spaces and the pipe character:

Code: Select all

20160101 iphone 6s order John Lewis | Your receipt.pdf
My code prepends the folder path and then use the two replace statements above which result is a string that revBrowser is able to use to display the file:

Code: Select all

The use of ERLEncode on the same file specification results in a string which causes revBrowser to fail:

Code: Select all

I am surprised that RevBrowser fails to locate the file when it's name has been encoded with URLEncode but this is probably down to my lack of understanding of the URL syntax. Is anyone able to explain what is going wrong.


best wishes

Post Reply

Return to “Mac OS”