Nogen der ved om der findes en URLEncode funktion, der kan bruges i
vbs-filer, svarende til Server.URLEncode i asp.
Man kan selvfølgelig bruge nedenstående (som virker helt som det skal), men
den fylder bare ret meget:
Function URLEncode(text)
tmptext = text
tmptext = replace(tmptext," ","%20")
tmptext = replace(tmptext,"!","%21")
tmptext = replace(tmptext,"""","%22")
tmptext = replace(tmptext,"#","%23")
tmptext = replace(tmptext,"$","%24")
tmptext = replace(tmptext,"%","%25")
tmptext = replace(tmptext,"&","%26")
tmptext = replace(tmptext,"'","%27")
tmptext = replace(tmptext,"(","%28")
tmptext = replace(tmptext,")","%29")
tmptext = replace(tmptext,"*","%2A")
tmptext = replace(tmptext,"+","%2B")
tmptext = replace(tmptext,",","%2C")
tmptext = replace(tmptext,"-","%2D")
tmptext = replace(tmptext,".","%2E")
tmptext = replace(tmptext,"/","%2F")
tmptext = replace(tmptext,"0","0")
tmptext = replace(tmptext,"1","1")
tmptext = replace(tmptext,"2","2")
tmptext = replace(tmptext,"3","3")
tmptext = replace(tmptext,"4","4")
tmptext = replace(tmptext,"5","5")
tmptext = replace(tmptext,"6","6")
tmptext = replace(tmptext,"7","7")
tmptext = replace(tmptext,"8","8")
tmptext = replace(tmptext,"9","9")
tmptext = replace(tmptext,":","%3A")
tmptext = replace(tmptext,";","%3B")
tmptext = replace(tmptext,"<","%3C")
tmptext = replace(tmptext,"=","%3D")
tmptext = replace(tmptext,">","%3E")
tmptext = replace(tmptext,"?","%3F")
tmptext = replace(tmptext,"@","%40")
tmptext = replace(tmptext,"A","A")
tmptext = replace(tmptext,"B","B")
tmptext = replace(tmptext,"C","C")
tmptext = replace(tmptext,"D","D")
tmptext = replace(tmptext,"E","E")
tmptext = replace(tmptext,"F","F")
tmptext = replace(tmptext,"G","G")
tmptext = replace(tmptext,"H","H")
tmptext = replace(tmptext,"I","I")
tmptext = replace(tmptext,"J","J")
tmptext = replace(tmptext,"K","K")
tmptext = replace(tmptext,"L","L")
tmptext = replace(tmptext,"M","M")
tmptext = replace(tmptext,"N","N")
tmptext = replace(tmptext,"O","O")
tmptext = replace(tmptext,"P","P")
tmptext = replace(tmptext,"Q","Q")
tmptext = replace(tmptext,"R","R")
tmptext = replace(tmptext,"S","S")
tmptext = replace(tmptext,"T","T")
tmptext = replace(tmptext,"U","U")
tmptext = replace(tmptext,"V","V")
tmptext = replace(tmptext,"W","W")
tmptext = replace(tmptext,"X","X")
tmptext = replace(tmptext,"Y","Y")
tmptext = replace(tmptext,"Z","Z")
tmptext = replace(tmptext,"[","%5B")
tmptext = replace(tmptext,"\","%5C")
tmptext = replace(tmptext,"]","%5D")
tmptext = replace(tmptext,"^","%5E")
tmptext = replace(tmptext,"_","%5F")
tmptext = replace(tmptext,"`","%60")
tmptext = replace(tmptext,"a","a")
tmptext = replace(tmptext,"b","b")
tmptext = replace(tmptext,"c","c")
tmptext = replace(tmptext,"d","d")
tmptext = replace(tmptext,"e","e")
tmptext = replace(tmptext,"f","f")
tmptext = replace(tmptext,"g","g")
tmptext = replace(tmptext,"h","h")
tmptext = replace(tmptext,"i","i")
tmptext = replace(tmptext,"j","j")
tmptext = replace(tmptext,"k","k")
tmptext = replace(tmptext,"l","l")
tmptext = replace(tmptext,"m","m")
tmptext = replace(tmptext,"n","n")
tmptext = replace(tmptext,"o","o")
tmptext = replace(tmptext,"p","p")
tmptext = replace(tmptext,"q","q")
tmptext = replace(tmptext,"r","r")
tmptext = replace(tmptext,"s","s")
tmptext = replace(tmptext,"t","t")
tmptext = replace(tmptext,"u","u")
tmptext = replace(tmptext,"v","v")
tmptext = replace(tmptext,"w","w")
tmptext = replace(tmptext,"x","x")
tmptext = replace(tmptext,"y","y")
tmptext = replace(tmptext,"z","z")
tmptext = replace(tmptext,"{","%7B")
tmptext = replace(tmptext,"|","%7C")
tmptext = replace(tmptext,"}","%7D")
tmptext = replace(tmptext,"~","%7E")
tmptext = replace(tmptext,"","%7F")
tmptext = replace(tmptext,"?","%80")
tmptext = replace(tmptext,"","%81")
tmptext = replace(tmptext,",","%82")
tmptext = replace(tmptext,"f","%83")
tmptext = replace(tmptext,""","%84")
tmptext = replace(tmptext,".","%85")
tmptext = replace(tmptext,"?","%86")
tmptext = replace(tmptext,"?","%87")
tmptext = replace(tmptext,"^","%88")
tmptext = replace(tmptext,"?","%89")
tmptext = replace(tmptext,"S","%8A")
tmptext = replace(tmptext,"<","%8B")
tmptext = replace(tmptext,"O","%8C")
tmptext = replace(tmptext,"","%8D")
tmptext = replace(tmptext,"Z","%8E")
tmptext = replace(tmptext,"","%8F")
tmptext = replace(tmptext,"","%90")
tmptext = replace(tmptext,"'","%91")
tmptext = replace(tmptext,"'","%92")
tmptext = replace(tmptext,""","%93")
tmptext = replace(tmptext,""","%94")
tmptext = replace(tmptext,".","%95")
tmptext = replace(tmptext,"-","%96")
tmptext = replace(tmptext,"-","%97")
tmptext = replace(tmptext,"~","%98")
tmptext = replace(tmptext,"T","%99")
tmptext = replace(tmptext,"s","%9A")
tmptext = replace(tmptext,">","%9B")
tmptext = replace(tmptext,"o","%9C")
tmptext = replace(tmptext,"","%9D")
tmptext = replace(tmptext,"z","%9E")
tmptext = replace(tmptext,"Y","%9F")
tmptext = replace(tmptext," ","%A0")
tmptext = replace(tmptext,"¡","%A1")
tmptext = replace(tmptext,"¢","%A2")
tmptext = replace(tmptext,"£","%A3")
tmptext = replace(tmptext,"¤","%A4")
tmptext = replace(tmptext,"¥","%A5")
tmptext = replace(tmptext,"¦","%A6")
tmptext = replace(tmptext,"§","%A7")
tmptext = replace(tmptext,"¨","%A8")
tmptext = replace(tmptext,"©","%A9")
tmptext = replace(tmptext,"ª","%AA")
tmptext = replace(tmptext,"«","%AB")
tmptext = replace(tmptext,"¬","%AC")
tmptext = replace(tmptext,"","%AD")
tmptext = replace(tmptext,"®","%AE")
tmptext = replace(tmptext,"¯","%AF")
tmptext = replace(tmptext,"°","%B0")
tmptext = replace(tmptext,"±","%B1")
tmptext = replace(tmptext,"²","%B2")
tmptext = replace(tmptext,"³","%B3")
tmptext = replace(tmptext,"´","%B4")
tmptext = replace(tmptext,"µ","%B5")
tmptext = replace(tmptext,"¶","%B6")
tmptext = replace(tmptext,"·","%B7")
tmptext = replace(tmptext,"¸","%B8")
tmptext = replace(tmptext,"¹","%B9")
tmptext = replace(tmptext,"º","%BA")
tmptext = replace(tmptext,"»","%BB")
tmptext = replace(tmptext,"¼","%BC")
tmptext = replace(tmptext,"½","%BD")
tmptext = replace(tmptext,"¾","%BE")
tmptext = replace(tmptext,"¿","%BF")
tmptext = replace(tmptext,"À","%C0")
tmptext = replace(tmptext,"Á","%C1")
tmptext = replace(tmptext,"Â","%C2")
tmptext = replace(tmptext,"Ã","%C3")
tmptext = replace(tmptext,"Ä","%C4")
tmptext = replace(tmptext,"Å","%C5")
tmptext = replace(tmptext,"Æ","%C6")
tmptext = replace(tmptext,"Ç","%C7")
tmptext = replace(tmptext,"È","%C8")
tmptext = replace(tmptext,"É","%C9")
tmptext = replace(tmptext,"Ê","%CA")
tmptext = replace(tmptext,"Ë","%CB")
tmptext = replace(tmptext,"Ì","%CC")
tmptext = replace(tmptext,"Í","%CD")
tmptext = replace(tmptext,"Î","%CE")
tmptext = replace(tmptext,"Ï","%CF")
tmptext = replace(tmptext,"Ð","%D0")
tmptext = replace(tmptext,"Ñ","%D1")
tmptext = replace(tmptext,"Ò","%D2")
tmptext = replace(tmptext,"Ó","%D3")
tmptext = replace(tmptext,"Ô","%D4")
tmptext = replace(tmptext,"Õ","%D5")
tmptext = replace(tmptext,"Ö","%D6")
tmptext = replace(tmptext,"×","%D7")
tmptext = replace(tmptext,"Ø","%D8")
tmptext = replace(tmptext,"Ù","%D9")
tmptext = replace(tmptext,"Ú","%DA")
tmptext = replace(tmptext,"Û","%DB")
tmptext = replace(tmptext,"Ü","%DC")
tmptext = replace(tmptext,"Ý","%DD")
tmptext = replace(tmptext,"Þ","%DE")
tmptext = replace(tmptext,"ß","%DF")
tmptext = replace(tmptext,"à","%E0")
tmptext = replace(tmptext,"á","%E1")
tmptext = replace(tmptext,"â","%E2")
tmptext = replace(tmptext,"ã","%E3")
tmptext = replace(tmptext,"ä","%E4")
tmptext = replace(tmptext,"å","%E5")
tmptext = replace(tmptext,"æ","%E6")
tmptext = replace(tmptext,"ç","%E7")
tmptext = replace(tmptext,"è","%E8")
tmptext = replace(tmptext,"é","%E9")
tmptext = replace(tmptext,"ê","%EA")
tmptext = replace(tmptext,"ë","%EB")
tmptext = replace(tmptext,"ì","%EC")
tmptext = replace(tmptext,"í","%ED")
tmptext = replace(tmptext,"î","%EE")
tmptext = replace(tmptext,"ï","%EF")
tmptext = replace(tmptext,"ð","%F0")
tmptext = replace(tmptext,"ñ","%F1")
tmptext = replace(tmptext,"ò","%F2")
tmptext = replace(tmptext,"ó","%F3")
tmptext = replace(tmptext,"ô","%F4")
tmptext = replace(tmptext,"õ","%F5")
tmptext = replace(tmptext,"ö","%F6")
tmptext = replace(tmptext,"÷","%F7")
tmptext = replace(tmptext,"ø","%F8")
tmptext = replace(tmptext,"ù","%F9")
tmptext = replace(tmptext,"ú","%FA")
tmptext = replace(tmptext,"û","%FB")
tmptext = replace(tmptext,"ü","%FC")
tmptext = replace(tmptext,"ý","%FD")
tmptext = replace(tmptext,"þ","%FE")
tmptext = replace(tmptext,"ÿ","%FF")
URLEncode = tmptext
End FUnction
Mvh. Christoffer Thygesen
|