1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
'/* Restricted Party Screening */ '/* URL ENCODING */ '/* Adapted: philipp@frenzel.net */ Public Function Encode_UTF8(astr) Dim c Dim utftext utftext = "" If isNull(astr) = false or astr <> "" Then astr = Replace(astr, "’", "'") 'replacing the apostrophe astr = Replace(astr, "–", "-") 'replacing the emdash with minus sign For n = 1 To Len(astr) c = Asc(Mid(astr, n, 1)) If c < 128 Then utftext = utftext + Mid(astr, n, 1) ElseIf ((c > 127) And (c < 2048)) Then utftext = utftext + Chr(((c \ 64) Or 192)) utftext = utftext + Chr(((c And 63) Or 128)) Else utftext = utftext + Chr(((c \ 144) Or 234)) utftext = utftext + Chr((((c \ 64) And 63) Or 128)) utftext = utftext + Chr(((c And 63) Or 128)) End If Next End If Encode_UTF8 = utftext End Function |