[Gambas-user] FromURL() converts + to space

Benoît Minisini benoit.minisini at gambas-basic.org
Wed Oct 18 21:30:52 CEST 2023


Le 18/10/2023 à 19:09, Bruce Steers a écrit :
> if i use
> 
> Print FromURL("AB+12.txt")
> 
> i get "AB 12.txt"
> 
> is that by design or a bug?
> 
> the bug has been discovered when using Drag.Paste("text/uri-list") when 
> using Drop on a control with a filename having a + in the name.
> it seems Drag.Paste("text/uri-list") seems to use the same FromURL() 
> function.
> 
> Respects
> BruceS
> 

Yes, it's my fault, it's buggy.

'+' is a space only in the query part of the URL, not in the path part 
where it must be kept as is.

Maybe FromUrl() could transform '+' in space after it has encountered a 
literal '?'.

Note that "AB+12.txt" is not URL, so there is no reason to send it to 
FromURL().

And there should be no problem with Url(), as '+' is always encoded into 
'%2B'.

Regards,

-- 
Benoît Minisini.



More information about the User mailing list