Register to post in forums, or Log in to your existing account
 

This forum is locked: you cannot post, reply to, or edit topics.  This topic is locked: you cannot edit posts or make replies.     Home » Forums » General zApp Discussion
Rainchild
Wizard


Joined: 10 Oct 2000
Posts: 1551
Location: Australia

PostPosted: Tue Nov 16, 2004 1:20 am   

String Library - URL Encode
 
I was concerned in: http://forums.zuggsoft.com/mx/modules/mx_kb/kb.php?mode=doc&k=1176

that you said

Quote:

Although the ASCII space character is listed as unsafe in this RFC, in practice a space is allowable in modern URLs. If you wish, you can convert spaces to '+' or '%20' codes using the str.Replace function:

str.Replace( Source, ' ', '+') or
str.Replace( Source, ' ', '%20')


Given that IE still uses %20 to this day, I think doing a second replace on a string after encoding the URL is scanning the string 2x... I guess URLs are usually small, but its the principal of the thing ;)

You should have another URL encode which does the %20 by default :)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Nov 16, 2004 1:25 am   
 
Can someone verify this? I can't think of a URL that uses a space in it off the top of my head, but I'm pretty sure that even IE allows spaces in URLs these days.

But in general, since this is a scripting language, scanning a string twice like a URL isn't a huge deal. If you want speed then you just write your own function that does both at once. I don't really feel a huge need to add yet another function or option for this. But if browsers still don't allow spaces these days, then I'll go ahead and convert spaces to %20 by default.

If someone has a URL with a space in it that can be used for testing, let me know.
Reply with quote
Krule
Adept


Joined: 12 Nov 2000
Posts: 268
Location: Canada

PostPosted: Tue Nov 16, 2004 4:48 am   
 
Url with spaces:

[url]http://krule.net/oldpics/pics/Books and Books.jpg[/url]

Firefox automagically translates it to this:
http://krule.net/oldpics/pics/Books%20and%20Books.jpg



(Thats a small fraction of the books in my room atm..heh)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Nov 16, 2004 11:11 am   
 
IE also converted this to %20
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Nov 16, 2004 6:04 pm   
 
Right. They convert it, but it still works. If you copy/paste it into IE it works. I guess the real test is to see if it works in a low-level HTTP GET request or not. I'll test this with the zApp stuff and find out.
Reply with quote
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Home » Forums » General zApp Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
© 2009 Zugg Software. Hosted on Wolfpaw.net