Code: Select all
Debug URLEncoder("D:\#something\")
Code: Select all
Debug URLEncoder("D:\#something\")
Output wrote:D:%5C#something%5C
So it doesn't work with yours, too? # is not encoded. But I guess thats intentionally. There are often multilevel encode functions available.RSBasic wrote:@Lunasole
Please use the latest version to test.
I tested in 5.50 Beta 1:Output wrote:D:%5C#something%5C
RFC 3986, section 2.4 wrote:Under normal circumstances, the only time when octets within a URI
are percent-encoded is during the process of producing the URI from
its component parts. This is when an implementation determines which
of the reserved characters are to be used as subcomponent delimiters
and which can be safely used as data.
RFC 3986, section 2.4 wrote:When a URI is dereferenced, the components and subcomponents
significant to the scheme-specific dereferencing process (if any)
must be parsed and separated before the percent-encoded octets within
those components can be safely decoded, as otherwise the data may be
mistaken for component delimiters.
I'm not using 'beta' and similar unstable stuff, also if I don't see a fix in changelogs, then I guess there no any fix was made.RSBasic wrote:@Lunasole
Please use the latest version to test.
I tested in 5.50 Beta 1:Output wrote:D:%5C#something%5C
That "javascript is my god" is not something I'll agree on, but the most basic call on URLEncode should be intuitively on the level of argument values (encoding all). There should however be a flag for specifying whether the input is an argument value, an argument,a query string or a whole url.Lunasole wrote:For simplicity there of course should be one UrlEncoder().
I don't know exact sets of chars that typical URL-encoders from other languages (web-languages) encoding, but at least in Notepad++ encoder plugin is encoding "#" char and in javascript as I remember it is encoded too.
So talking about "how it should be" I think the better is to copy-paste this function from javascript runtime instead of writing own bicycle and guessing how it should work, there are many of it's implementation in lot of browser engines/js engines and so on.
It is not a godDarkDragon wrote: That "javascript is my god" is not something I'll agree on, but the most basic call on URLEncode should be intuitively on the level of argument values (encoding all). There should however be a flag for specifying whether the input is an argument value, an argument,a query string or a whole url.
Code: Select all
; convert file path to URL
Procedure$ PathToURL (Path$)
Path$ = ReplaceString(Path$, "\", "/")
Path$ = URLEncoder(Path$, #PB_UTF8)
Path$ = ReplaceString(Path$, "#", "%23") ; workaround of PB Urlencoder bug
ProcedureReturn Path$
EndProcedure