https://bz.apache.org/ooo/show_bug.cgi?id=126731

--- Comment #3 from Andreas Säger <[email protected]> ---
Sorry, the expected result for Expected: ConvertToURL("C:\Foo&Bar") is
file:///C:/Foo%26Bar of course.

This is a possible work-around for Basic coders:

Function WorkAround_ConvertToURL(sysPath) As String
Dim oSrv, a(), sURL$, nSplit&, sCode$, sProtocol$, sPathName$, sChar$, sRoot$
    sURL = convertToURL(sysPath)
    a() = Array("!", "$", "&", "'", "(", ")", "*", "+", ",", ":", "=", "@")
    If getGUIType = 1 then
        nSplit = 11
    else
        nSplit = 8
    endif
    sProtocol = left(sURL, nSPlit)
    sPathName = mid(sURL, nSplit +1)
    oSrv = createUnoService("com.sun.star.sheet.FunctionAccess")
    For each sChar in a()
        if instr(sPathName, sChar) > 0 then
            sCode = "%"& hex(asc(sChar))
            sPathName = oSrv.callFunction("SUBSTITUTE", Array(sPathName, sChar,
sCode))
        endif
    next
    WorkAround_ConvertToURL = sProtocol & sPathName
End Function

-- 
You are receiving this mail because:
You are the assignee for the issue.

Reply via email to