[Gambas-user] URL encoding "%20"

werner 007 admin at ...1080...
Tue Dec 30 14:03:46 CET 2008



werner 007 wrote:
> 
> Does anybody know a easy way to convert url encoded strings (like "%20")
> to normal characters?
> 
> Btw: Nice would be Conv$("%20", url, utf8).
> 
> 
> Regards, werner(007)
> 

Ok, i got the answer by my self. 
The chars of not printable and non-ascii are represented as Hex. 
To convert it back:

PUBLIC FUNCTION url_encode(url_string AS String) AS String
  DIM i AS Integer
  FOR i = 0 TO 32
    url_string = Replace(url_string, "%" & Hex$(i, 2), Chr(i))
  NEXT 
  FOR i = 127 TO 255
    url_string = Replace(url_string, "%" & Hex$(i, 2), Chr(i))
  NEXT 
  RETURN url_string
END
-- 
View this message in context: http://www.nabble.com/URL-encoding-%22-20%22-tp21216641p21216909.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list