Hi all,
I'm having trouble viewing documents in my browser if the document name has any spaces. I'm trying to replace spaces with %20 for the browser... but when I run my code, it replaces space with %2520 ... here's an example:
file:///E:/BenchTop_Documents/Workorder/1000188714/Sample%2520Datasheet.pdf
Here's the code:
// If the file exists, view it in a browser window
//First replace spaces with %20
long start_pos=1
string old_str, new_str
old_str = ' '
new_str = '%20'
// Find the first occurrence of old_str.
start_pos = Pos(ls_filename, old_str, start_pos)
// Only enter the loop if you find old_str.
DO WHILE start_pos > 0
// Replace old_str with new_str.
ls_filename = Replace(ls_filename, start_pos, &
Len(old_str), new_str)
// Find the next occurrence of old_str.
start_pos = Pos(ls_filename, old_str, &
start_pos+Len(new_str))
LOOP
if lb_FileExists then
GetContextService("Internet", iinet_base)
iinet_base.HyperlinkToURL(ls_filename)
else
MessageBox("View Document","Could not locate file: ~r~n" + ls_filename)
end if
Any suggestions on how to fix this is greatly appreciated.
~~~Tracy
I'd call it something like "linet_base".)
regards.