Below you'll find the source for the Visual Basic 6 function rawurlencode.
Attribute VB_Name = "modRawurlencode"
' This function is downloaded from:
' http://www.stefanthoolen.nl/archive/vb6-functions/
'
' You may freely distribute this file but please leave all comments, including this one, in it.
'
' @Author Stefan Thoolen <mail@stefanthoolen.nl>
Option Explicit
''
' URL-encode according to RFC 1738
' Same syntax as the PHP function 'rawurlencode'
' See also: http://www.php.net/manual/en/function.rawurlencode.php
' @param String tstr The normal string
' @return String An encoded string
' @author Stefan Thoolen <mail@stefanthoolen.nl>
Public Function rawurlencode(tstr As String) As String
Dim retval As String, i As Integer, j As Integer, s As String, t As String
For i = 1 To Len(tstr)
s = Mid(tstr, i, 1): j = Asc(s)
If s = "_" Or _
s = "-" Or _
s = "." Or _
(j >= Asc("a") And j <= Asc("z")) Or _
(j >= Asc("A") And j <= Asc("Z")) Or _
(j >= Asc("0") And j <= Asc("9")) Then
retval = retval & s
Else
t = Hex(j): If Len(t) = 1 Then t = "0" & t
retval = retval & "%" & t
End If
Next i
rawurlencode = retval
End Function