LotusScript Version of JavaScript-Escape

When passing arguments in URLs on the Web, you must ensure that all characters are "Web-safe". This LotusScript function performs the eqivalent of a JavaScript-Escape.

Function LSescape(strIn As String) As String
' This function performs the equivalent of a JavaScript escape.
' Kenneth H?man, TJ Group AB.
Dim strAllowed As String
Dim i As Integer
Dim strChar As String
Dim strReturn As String

'These are the characters that the JavaScript escape-function allows, so we let them pass
'unchanged in this function as well.
strAllowed = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" & "@/.*-_"
i = 1
strReturn = ""

While Not (i > Len(strIn))
strChar = Mid$(strIn, i, 1)
If Instr(1, strAllowed, strChar) > 0 Then
strReturn = strReturn & strChar
strReturn = strReturn & "%" & Hex$(Asc(strChar))
End If
i = i + 1

LSescape = strReturn

End Function

Dig Deeper on Domino Resources



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury