Page 1 of 1

UTF-8 and Hotmail

Posted: Mon Dec 04, 2006 10:09 am
by cybernga
Hello,

first of all, thank you for this wonderful library :) On with the question now :

I'm trying to send email written in Greek. The text is converted to UTF-8, and Swift sends it away without any problems. However, Hotmail ( and some other mailers ) display gibberish - in the case of Hotmail, switching to UTF-8 manually partially corrects the problem ( some characters are replaced with question marks ), but clicking on the part link correctly displays the message... what gives ?

Some specifics:

1. The email source code, as received by Hotmail :

Code: Select all

X-Message-Status: n:0
X-SID-PRA: myserver@mycompany.gr
X-Message-Info: txF49lGdW41c15PANX/PkPveWkASMyApdpYwsQiv5A4=
Received: from mycompany.gr ([xxx.xxx.xxx.xxx]) by bay0-mc9-f10.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2444);
	 Mon, 4 Dec 2006 07:28:56 -0800
Received: from webserver (localhost [127.0.0.1])
	by webserver.mycompany.gr (Postfix) with ESMTP id CCBCE798064
	for <cybernga@hotmail.com>; Mon,  4 Dec 2006 17:28:44 +0200 (EET)
To: cybernga@hotmail.com
From: myserver@mycompany.gr
Reply-To: <myserver@mycompany.gr>
Subject: Contact Form GR
Date: Mon, 04 Dec 2006 17:28:44 +0200
X-Mailer: Swift 2.1.17 by Chris Corbyn
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="_=_swift-31183962345743eaccb79e8.18221678"
Content-Transfer-Encoding: 8bit
Message-Id: <20061204152844.CCBCE798064@webserver.mycompany>
Return-Path: myserver@mycompany.gr
X-OriginalArrivalTime: 04 Dec 2006 15:28:57.0421 (UTC) FILETIME=[EA367FD0:01C717B8]

This part of the E-mail should never be seen. If
you are reading this, consider upgrading your e-mail
client to a MIME-compatible client.
--_=_swift-31183962345743eaccb79e8.18221678
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: 8bit




ΦΟΡΜΑ ΕΠΙΚΟΙÎ

Posted: Mon Dec 04, 2006 11:39 am
by Chris Corbyn
It's hotmail using the wrong character set (no doubt some windows one) because you have full header view enabled I guess. If you just view the correct part I imagine hotmail will use the charset of that part.

It's common for web-based email providers to have a real problem dealing with character sets although utf-8 is usually the way to go.

Have you tried sending the same email in UTF-8 to Hotmail with thunderbird or similar? Swift doesn't "convert" character sets. it just takes whatever you tell it for granted. When you say the text has been converted, how was this done?

Posted: Mon Dec 04, 2006 11:50 am
by cybernga
for starters, thank you for your reply :)

indeed when viewing only the part the text is displayed correctly. the reason I was wondring is because gmail handles it just fine, and so do my local email clients (thunderbird, even mutt)
edit: I mean that gmail shows utf-8 even though the rest of its interface is in latin-1, and so do the local clients.

from what I've been reading it's probably a Hotmail problem - I tried forwarding to Hotmail the email I received from Swift in Gmail, and the same results arised (not that it had no visible problems in Gmail )

as for the conversion, I should have said that the data entry is in UTF-8 (the whole webpage is in UTF-8 so the data received from the web form is in UTF-8 too (checked by using something like "print $body" between the code, which spat out the message body and the browser correctly identified it as UTF-8 and displayed it without probs).

save for re-coding the whole email to something like iso-8859-7 or win-1253 ( Iso Greek and Windows Greek respectively) I dont' see hotmail being able to receive this without work on their part :( guess I'll have to live with that.

Posted: Mon Dec 04, 2006 1:07 pm
by Chris Corbyn
I need to double check but I have a feeling it's permissible to add 3 parts (one with a character set just for hotmail).

Don't do that until I double check the RFC though. I'll reply shortly. If it's not valid hotmail will choke on it completely and probably think it's got an attachment or something.

Posted: Mon Dec 04, 2006 1:21 pm
by Chris Corbyn
OK well RFC 2045 doesn't say you can't do it, and syntactically it will work so feel free to add yet another "part" with a different encoding for Hotmail if you are able to :)

Posted: Wed Dec 06, 2006 1:29 am
by cybernga
First of all, thank you for your time and effort :)

After the discussion here we've decided that since the email part of the website is mainly being used for administrative feedback ( customer fills in a form, sends it to customer care ), we can safely ignore Hotmail; thus the discussion here is mainly academic since I might bump into this problem in the future :)

Currently, as you can see, I'm sending a plaintext UTF-8 part and a UTF-8 HTML part - if I understand correctly you are suggesting to add another plaintext part in a localized encoding ( e.g. ISO-8859-7 which is Greek ) so that the email has three parts. I will give it a shot, and post the results here :)

Again, thank you for your prompt replies :)