You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2015/12/11 14:58:23 UTC

[Issue 126731] New: Basic ConvertToURL fails to URL encode many characters

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

          Issue ID: 126731
        Issue Type: DEFECT
           Summary: Basic ConvertToURL fails to URL encode many characters
           Product: App Dev
           Version: 4.1.2
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P5 (lowest)
         Component: scripting
          Assignee: issues@openoffice.apache.org
          Reporter: villeroy@t-online.de

OK: ConvertToURL("C:\Foo Bar") --> file:///C:/Foo&20Bar
Fail: ConvertToURL("C:\Foo&Bar") --> file:///C:/Foo&Bar
Expected: ConvertToURL("C:\Foo&Bar") --> file:///C:/Foo&26Bar

Problem occurs with characters
!
$
&
'
(
)
*
+
,
/
:
=
@

ConvertToURL correctly encodes the follwing characters:
<space> 
"
#
%
;
?
[
\
]
{
|
}


Reference:
https://tools.ietf.org/html/rfc3986#page-12

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

[Issue 126731] Basic ConvertToURL fails to URL encode many characters

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126731

--- Comment #1 from Andreas Säger <vi...@t-online.de> ---
Created attachment 85206
  --> https://bz.apache.org/ooo/attachment.cgi?id=85206&action=edit
Spreadsheet with user-defined Basic functions

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

[Issue 126731] Basic ConvertToURL fails to URL encode many characters

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126731

--- Comment #2 from Andreas Säger <vi...@t-online.de> ---
Same with PyUNO:
>>> s = '/foo & bar/concept.odt'
>>> uno.systemPathToFileUrl(s)
'file:///foo%20&%20bar/concept.odt'

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

[Issue 126731] Basic ConvertToURL fails to URL encode many characters

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126731

Regina Henschel <rb...@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rb.henschel@t-online.de

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

[Issue 126731] Basic ConvertToURL fails to URL encode many characters

Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126731

--- Comment #3 from Andreas Säger <vi...@t-online.de> ---
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.