We use a VB Function to generate the mail addresses. It encodes the addresses to UTF-8 or hex.
You can convert it to any language you wish.
This is the VB.NET code:
' Convert An Input String To Unicode Character Codes
Public Enum CloakType
UTF8_1
UTF8_2
HEX_1
HEX_2
UniCode
End Enum
Public Function CloakIt(ByVal inTxt As String, ByVal iType As CloakType) As String
Dim iInd As Integer
Dim sOut As String
sOut = ""
If Len(inTxt) = 0 Then
CloakIt = ""
Exit Function
End If
For iInd = 1 To Len(inTxt)
Select Case iType
Case CloakType.UTF8_2 ', 2
' Long UTF-8 encoding without semicolons
sOut = sOut & "&#" & Right("0000000" & CStr(Asc(Mid(inTxt, iInd, 1))), 7)
Case CloakType.HEX_1 ', 3
' Hex encoding without semicolons
sOut = sOut & "&#x" & Hex(Asc(Mid(inTxt, iInd, 1)))
Case CloakType.HEX_2 ', 4
' Hex encoding with semicolons
sOut = sOut & "&#x" & Hex(Asc(Mid(inTxt, iInd, 1))) & ";"
Case CloakType.UniCode ', 5
' Unicode 2 Byte Hex encoding with semicolons
sOut = sOut & "�" & Hex(Asc(Mid(inTxt, iInd, 1))) & ";"
Case Else
' UTF-8 Unicode Encoding
sOut = sOut & "&#" & CStr(Asc(Mid(inTxt, iInd, 1))) & ";"
End Select
Next
CloakIt = sOut
End Function