我们如何对IBM Domino lotusscript代理中从请求接收的文本进行URL解码?
答案 0 :(得分:5)
不幸的是,LotusScript中没有默认的URLdecode-函数。我总是使用Evaluate
:
Dim varResult as Variant
Dim strUrl as String
Dim strUrlDecoded as String
strUrl = "Employee%2FMy%20Database.nsf"
varResult = Evaluate( {@URLDecode( "Domino"; "} & strUrl & {" )} )
strUrlDecoded = varResult( 0 )
答案 1 :(得分:2)
一些简单的谷歌搜索显示了几个实现,如这一个:
Function URLDecode(inpString As String) As String
Dim temp As String
Dim hexValue As String
Dim ch As String
Dim pos As Integer
Dim newPos As Integer
' First, replace any plus signs with spaces
temp = inpString
While Instr(temp, "+") <> 0
temp = Left(temp, Instr(temp, "+")-1) & " " & Mid(temp, Instr(temp, "+")+1)
Wend
' Next, replace any "%x" encodings with the character
pos = 1
While Instr(pos, temp, "%x") <> 0
hexValue = Mid(temp, Instr(pos, temp, "%x")+2, 2)
ch = Chr$(Val("&H" & hexValue))
newPos = Instr(pos, temp, "%x")+2
temp = Left(temp, Instr(pos, temp, "%x")-1) & ch & Mid(temp, Instr(pos, temp, "%x")+4)
pos = newPos
Wend
' Next, replace any "%u" encodings with the Unicode character
pos = 1
While Instr(pos, temp, "%u") <> 0
hexValue = Mid(temp, Instr(pos, temp, "%u")+2, 4) ' Unicode encodings are 4 hex characters
ch = Uchr$(Val("&H" & hexValue))
newPos = Instr(pos, temp, "%u")+2 ' Skip over so we don't find "%" if that's what it was decoded to
temp = Left(temp, Instr(pos, temp, "%u")-1) & ch & Mid(temp, Instr(pos, temp, "%u")+6)
pos = newPos
Wend
' Next, replace any "%" encodings with the character
pos = 1
While Instr(pos, temp, "%") <> 0
hexValue = Mid(temp, Instr(pos, temp, "%")+1, 2)
ch = Chr$(Val("&H" & hexValue))
newPos = Instr(pos, temp, "%")+1
temp = Left(temp, Instr(pos, temp, "%")-1) & ch & Mid(temp, Instr(pos, temp, "%")+3)
pos = newPos
Wend
URLDecode = temp
End Function
来源:http://www.breakingpar.com/bkp/home.nsf/0/830B9F6BB4A899AB87256AFB0014A04A
答案 2 :(得分:0)
如果代理可以看到'CGI'字段(在documentContext上),那么使用'QUERY_STRING_DECODED'字段,该字段将包含查询字符串,已解码!