base:DecodeURL()

You can post your code snippets here for others to use and learn from

base:DecodeURL()

Postby djrikki » Wed Apr 15, 2015 11:45 pm

Returns a RFC 3986 encoded URL as a UTF-8 string.

Code: Select all
Global base
base = {}

;; base:DecodeURL(data$)
; Decodes a URL (RFC 3986) to UTF-8
Function base:DecodeURL(data$)
    data$ = ReplaceStr(data$,"%25","%")
    data$ = ReplaceStr(data$,"%24","\\$")
    data$ = ReplaceStr(data$,"%26","&")
    data$ = ReplaceStr(data$,"%2B","+")
    data$ = ReplaceStr(data$,"%2C",",")
    data$ = ReplaceStr(data$,"%2D","-")
    data$ = ReplaceStr(data$,"%2E",".")
    data$ = ReplaceStr(data$,"%2F","/")
    data$ = ReplaceStr(data$,"%3A",":")
    data$ = ReplaceStr(data$,"%3B",";")
    data$ = ReplaceStr(data$,"%3D","=")
    data$ = ReplaceStr(data$,"%3F","?")
    data$ = ReplaceStr(data$,"%40","@")
    data$ = ReplaceStr(data$,"%20"," ")
    data$ = ReplaceStr(data$,"%22","\"")
    data$ = ReplaceStr(data$,"%27","'")
    data$ = ReplaceStr(data$,"%28","(")
    data$ = ReplaceStr(data$,"%29",")")
    data$ = ReplaceStr(data$,"%3C","<")
    data$ = ReplaceStr(data$,"%3E",">")
    data$ = ReplaceStr(data$,"%23","#")
    data$ = ReplaceStr(data$,"%7B","{")
    data$ = ReplaceStr(data$,"%7D","}")
    data$ = ReplaceStr(data$,"%7C","|")
    data$ = ReplaceStr(data$,"%5C","\\")
    data$ = ReplaceStr(data$,"%21","!")
    data$ = ReplaceStr(data$,"%5E","^")
    data$ = ReplaceStr(data$,"%7E","~")
    data$ = ReplaceStr(data$,"%5B","[")
    data$ = ReplaceStr(data$,"%5D","]")
    data$ = ReplaceStr(data$,"%60","`")
    data$ = ReplaceStr(data$,"\"","*\"")
    data$ = ReplaceStr(data$,"%5F","_")
    data$ = ReplaceStr(data$,"%0A","\n")
       
    Return(data$)
EndFunction
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
djrikki
 
Posts: 645
Joined: Wed Apr 06, 2011 12:26 am

Return to Code snippets area

Who is online

Users browsing this forum: No registered users and 1 guest

cron