Function escape(Byval s$) As String
Dim i%, result$, c$
For i = 1 To Len(s)
c = Mid$(s, i, 1)
If Instr("#'%&/:;<'=´>?@[\]^`{|}~á+", c) = 0 Then
result = result & c
Else
'___Replace invalid characters to HTML "%" hex codes.
'result = result & "%" & Right$("0" & Hex(Uni(c)), 2)
'__Replaces invalid characters with a tilde "~"
result = result & "~"
End If
Next
escape = result
End Function