in reply to Character encoding in emails

So, let me ask this. Did you create a multi-part email message with HTML code and insert something like ☕ ☕ and it came out like a question mark instead? That may be just something on the recipient's end that is preventing the icon from showing up, OR you're using a font in the HTML email that does not have such characters on the recipient's end.

Replies are listed 'Best First'.
Re^2: Character encoding in emails
by Bod (Parson) on Dec 07, 2023 at 00:08 UTC

    In this case, the code came from ChatGPT, which inserted an emoji into its output. The lines of text from ChatGPT were wrapped in HTML tags and passed to the email sending processes. Identical input text with identical emojis was passed to both processes.

    That may be just something on the recipient's end

    For testing purposes, I am the recipient. On my mobile email client and on Outlook for desktop, emails sent through the queue display the emoji and ones sent directly don't.

      So, then your questions to answer are:
      1. What was the encoding of the data you received from ChatGPT?
      2. Did you store it in a unicode-aware database column type and with unicode enabled on the DBI connection?
      3. Did you read it back out with unicode enabled on the DBI connection?
      4. What was the encoding of the strings containing your HTML?
      5. What encoding did your MIME construction code expect?

      and my standard suggestion is to make sure you decoded bytes into unicode from the moment it enters your program until the time it exits your program (or in this case, until the time that you construct the MIME, because MIME should always be 7-bit ascii)