I am trying to send an email with utf-8 encoded text including an emoji, but the message received doesn’t appear to have it’s content encoded and the emoji isn’t displaying correctly.
Yes, use CURL from MBS or the Chilkat plugin. Xojo’s email functionality is very basic. I think that might be a pun.
1 Like
The answer is to convert the emoji into a XHTML value and then use BodyHTML to hold the message.
Public Function ConvertStringToXHTML(Value As String) as String
// Value is a UTF-8 encoded string that may contain an emoji
// Result will contain the same string, but emoji's will be converted to XHTML values
Var Result As String
For i As Integer = 0 To Value.Length - 1
Var s As String = Value.Middle(i, 1)
If s.Bytes = 1 Then
Result = Result + s
Else
s = s.ConvertEncoding(Encodings.UTF32)
Var j As Integer
For k As Integer = s.Bytes - 1 DownTo 0
j = j * 256 + s.MiddleBytes(k, 1).AscByte
Next
Result = Result + "&#" + j.ToString + ";"
End If
Next
Return Result
End Function
1 Like